Commit Graph

7469 Commits

Author SHA1 Message Date
Martin Böttcher
fa5dbfa234
improve ContactsManagerCache performance (#4026)
* added details for Signalyzer; improved ContactsManagerCache
* some minor runtime improvements
* systems contacts are written and read in big chunks to improve overall performance
* use of __file__, __function__ and __line__ when monitoring objective C methods
* minor changes
* minor changed based on review comments
2022-03-03 09:30:31 +01:00
Martin Böttcher
ff9f451c40
enhanced logging for better/automated performance analysis (#4039)
* added log output allowing automated performance analysis of app start and basic operations
* adjusted log messages
* changed logged event title
2022-03-03 08:15:40 +01:00
Michelle Linington
601e2cba7d Fix spurious assert.
This assert was added to try and catch instances where we fail to map
the local address to the localProfile sentinel because the local address
hasn't been loaded by tsAccountManager.

We don't care about the reverse direction. There are instances at
startup where the we are fetching the localProfile using the known
sentinel before the local address has been loaded. In these instances,
we don't care that the local address hasn't been loaded since the
mapping has already been performed.
2022-03-02 16:34:24 -08:00
Martin Böttcher
f670447fd9
removed some compiler warnings (#4027) 2022-03-02 09:26:58 +01:00
Jordan Rose
acba11b966 Turn on OWSLogger's aggressive flushing in the NSE for everyone
And do it sooner: at 5MB remaining instead of 1MB. This matches the
inverted condition of 20MB used, as well as where we're seeing sudden
spikes and then nothing in our logs.
2022-03-01 16:19:38 -08:00
Jordan Rose
0c04b3e575 Log on network requests with large content lengths
This is intended to catch requests to the server that could be causing
problems in the memory-constrained environment of the NSE. It's
unlikely, since we log *all* network requests and we haven't seen any
suspicious ones, but it could still be useful in the future.

Note that this only applies to data tasks, not download tasks; a
download task can be as big as it needs to be.
2022-03-01 16:19:38 -08:00
George Nachman
d305bc66a3 Optimize searching for verification status, redux.
Commit 451fa08c22
had some bugs and was reverted by commit
12883e5db5.

This commit brings it back along with fixes.

Specific bug fixes:

* Verification status for a group was inverted.
* The local address should not be considered for
  deciding if a group is verified.
2022-03-01 14:15:11 -08:00
Michelle Linington
9929970186 Merge branch 'release/5.30.0' 2022-02-25 17:37:54 -08:00
Michelle Linington
a3fbd6b56d "Feature flags for .qa." 2022-02-25 17:36:22 -08:00
Michelle Linington
bd7d75e574 "Feature flags for .beta." 2022-02-25 17:36:16 -08:00
Michelle Linington
3bfc06ae69 "Feature flags for .production." 2022-02-25 17:36:10 -08:00
Michelle Linington
1b4460748c Additional avatar logging 2022-02-25 17:28:08 -08:00
Martin Böttcher
c4f967ef46
removed checks testing for iOS12.0 or newer (#4030) 2022-02-25 17:39:12 +01:00
Michelle Linington
8ac12e969a "Feature flags for .qa." 2022-02-23 15:48:15 -08:00
Michelle Linington
3961d4d11f "Feature flags for .beta." 2022-02-23 15:48:09 -08:00
Michelle Linington
12883e5db5 Revert "Optimize searching for verification status."
This reverts commit 451fa08c22.
2022-02-23 15:22:28 -08:00
Michelle Linington
9b2980fd8a Lint 2022-02-22 12:41:27 -08:00
Michelle Linington
0f57b13e1d Drop Starscream dependency 2022-02-22 12:41:04 -08:00
Michelle Linington
fc1a94b5dc PR Feedback 2022-02-22 12:41:04 -08:00
Michelle Linington
35575c8659 Factor out common parsing behavior 2022-02-22 12:41:04 -08:00
Michelle Linington
f63ff7a120 Improved error plubming 2022-02-22 12:41:04 -08:00
Michelle Linington
e00e43ec95 Perform CDS requests against HSM backed service 2022-02-22 12:41:04 -08:00
Michelle Linington
aadd176cb9 Add CDS Constants 2022-02-22 12:41:04 -08:00
Michelle Linington
1f2e39b07a WebSocket responses can now vend raw bytes 2022-02-22 12:41:04 -08:00
Michelle Linington
886a9f8e6f Generate CDS protos 2022-02-22 12:41:04 -08:00
Michelle Linington
d8ab56e1fb IOS-2025: Image not appearing when replied to 2022-02-18 15:36:38 -08:00
George Nachman
451fa08c22 Optimize searching for verification status.
When opening a group chat we check if all
participants are verified (which confers to the
chat verified status and a "✓ Verified" label in
the header) and we also check if any participants
have the "no longer verified" status so we can
warn you about potential misdeeds.

Previously, this was done by performing a select
statement for each participant twice (once for
"are all verified" and again for "is any
no-longer-verified").

This change uses a join in a select statement
instead to reduce the number of queries performed.

Given existing indexes in the DB this can be done
efficiently. Adding additional indexes does not
seem to help - or at least I wasn't able to get
sqlite to use them.

Since most chats are not verified, we use a LIMIT
clause when possible to allow the DB to stop
early, which should make queries even cheaper.
2022-02-18 12:32:58 -08:00
Nora Trapp
545b1254dc "Feature flags for .qa." 2022-02-17 14:36:08 -08:00
Nora Trapp
7a2d3ad051 Merge branch 'release/5.29.0' 2022-02-17 14:35:57 -08:00
Nora Trapp
0eb492b4c2 "Feature flags for .beta." 2022-02-17 14:34:38 -08:00
Nora Trapp
ebfd4c7f71 Fix avatar migration 2022-02-17 14:32:18 -08:00
Martin Böttcher
22ff15bcb6 Add the "Signalyzer" Instruments tool 2022-02-17 14:07:57 -08:00
Michelle Linington
4b51afe2d0 Merge branch 'release/5.29.0' 2022-02-16 16:33:32 -08:00
Michelle Linington
f46faaf6d6 Re-enable the native websocket 2022-02-16 16:26:56 -08:00
Jordan Rose
99389aecba When a message to retry isn't in the MSL, don't fetch a thread later
OWSOutgoingResendResponse is *usually* resending a message that the
other party failed to decrypt, but if that message can't be found it
still tries to reset a 1:1 session or provide a missing sender key. In
these cases, it was trying to fetch the nonexistent thread by nil ID,
which was getting converted to an empty string in Swift for
compatibility reasons, which we have a debug-only `assert` to prevent
in SDS code. Just skip that step; it will come back empty anyway.
2022-02-16 14:07:15 -08:00
Michelle Linington
625b705ebf "Feature flags for .qa." 2022-02-16 14:05:03 -08:00
Michelle Linington
c9862b88f1 "Feature flags for .beta." 2022-02-16 14:04:53 -08:00
Jordan Rose
a171697228 Enumerate unread messages instead of returning an array of them
Also, sort them in the database query, so they don't need to be sorted
afterwards. (This is important for existing code that works in
batches.)

We do lose an optimization where the unread messages are counted in a
read query before marked read in a write query. If that's important I
can contrive a way to put it back.
2022-02-11 16:22:32 -08:00
George Nachman
7702463524 Temporarily increase user profile cache size.
PR 2982 optimized
ConversationViewController.createGroupMembershipCollisionBannerIfNecessary`
that fetches user profiles off the main thread and
then, when that completes, uses them on the main
thread to find duplicate display names.

The optimization doesn't work for large groups.
Because `UserProfileReadCache` is backed by an
LRUCache with a maximum capacity of 32, there is
effectively no cache and profiles get fetched
twice.

The main purpose of this commit is to fix this
optimization for large groups without expanding
memory usage unnecessarily. While increasing the
LRU cache's size to 1000 (or some other arbitrary
value) would fix the problem very simply, my gut
tells me that we're going to keep running into
this problem.

Rather than pick an arbitrary "large enough"
value, this commit increases the cache size to be
just large enough for its intended purpose and to
keep it that size for just long enough to do its
job.

This commit introduces the concept of a "lease" on
a larger cache size. The cache's size is defined
as the largest of all its leases plus its
"regular" size (the size it was initialized with).
For now only the user profile cache uses it.
2022-02-11 13:20:12 -08:00
Nora Trapp
aeaf5d86d6 Don't show subscription megaphone again until your subscription has been expired for at least 2 weeks 2022-02-11 13:09:20 -08:00
Nora Trapp
39d358610a Don't index group membership on TSGroupThread 2022-02-11 12:58:48 -08:00
Nora Trapp
c90aee41db Eliminate use of BidirectionalDictionary in StorageServiceManager 2022-02-11 10:09:57 -08:00
Nora Trapp
7894a4e62f Restore from storage service in pages 2022-02-10 11:08:25 -08:00
Jordan Rose
6b082d8dc5 Store SenderKeyRecords as Data, not Array, since we use Codable
Also fix a typo in a helper method name.
2022-02-10 09:50:45 -08:00
Nora Trapp
b2c0e975b6 Store group avatars on disk 2022-02-09 11:56:03 -08:00
Jordan Rose
809e9eb786 SSK: Don't use TSGroupModel's groupMembers array for V2 groups
Don't allocate it ahead of time, don't serialize or deserialize it
through MTLModel's NSCoding support. It's redundant with the
GroupMembership property.

While here, make comparing the members of two groups a little faster,
if not quite as simple.
2022-02-09 11:02:05 -08:00
Michelle Linington
f9c60bb013 "Feature flags for .qa." 2022-02-08 18:47:55 -08:00
Michelle Linington
04a8b39dbf "Feature flags for .beta." 2022-02-08 18:47:49 -08:00
Michelle Linington
ee23ce07f5 "Feature flags for .qa." 2022-02-08 18:35:01 -08:00
Michelle Linington
d3802b4755 "Feature flags for .beta." 2022-02-08 18:34:49 -08:00