Signal-iOS/SignalServiceKit/src
george-signal ec66f3b21e
Break envelope processing into two parts (#4340)
The purpose of this change is to alleviate the
main source of CPU-grinding after sending a
message to a large group: about 20% of the total
time is spent decoding and re-encoding messages as
they are fetched from the DB and then updated with
info about which recipients have acknowledged
delivery.

Prior to this commit, we decrypted the payload and
then processed the message in a single rather deep
call tree that began in `processNextBatch`. There
are two completely different paths through this
tree that lead to handling a delivery receipt
because server-generated delivery receipts have
the necessary info in plaintext in the envelope
and client-generated delivery receipts have it in
the ciphertext.

The idea here is to break incoming envelope
handling into two parts.

In the first part, each envelope is decrypted and
other common activities (like handling sender key
distribution messages) are performed. A processing
request is created for each. Next, processing
requests are handled. It's easy to examine a
processing request to determine if it is a
delivery receipt, and if so, for what outgoing
message. Doing so allows the new
DeliveryReceiptContext class to cache message
fetches and combine updates to the same message.

Processing requests are grouped together so that
sequential delivery receipt requests enjoy caching
of messages and coalescing of updates into a
single fetch/decode/encode/commit. Other kinds of
envelopes are handled immediately to avoid
increasing memory pressure that caching multiple
messages could cause.
2022-06-09 16:40:34 -07:00
..
Account PNP: Clear phone number sharing flag after getting a delivery receipt 2022-05-20 10:48:22 -07:00
Contacts Fix SwiftLint shorthand_operator violations 2022-06-07 14:51:57 +00:00
Devices Fix SwiftLint shorthand_operator violations 2022-06-07 14:51:57 +00:00
groups Prefer implicit getters 2022-06-06 14:00:15 +00:00
Messages Break envelope processing into two parts (#4340) 2022-06-09 16:40:34 -07:00
Network Fix SwiftLint shorthand_operator violations 2022-06-07 14:51:57 +00:00
Payments Fix SwiftLint shorthand_operator violations 2022-06-07 14:51:57 +00:00
Protocols Check if a user is stories capable when sending group replies 2022-03-31 00:37:56 -07:00
Protos Protos: Remove unused fields from DataMessage.Quote 2022-06-03 10:34:21 -07:00
Remote Attestation Update to LibSignalClient v0.15.0 2022-03-24 11:55:45 -07:00
Security Fix SwiftLint shorthand_operator violations 2022-06-07 14:51:57 +00:00
Storage Fix SwiftLint shorthand_operator violations 2022-06-07 14:51:57 +00:00
TestUtils Break envelope processing into two parts (#4340) 2022-06-09 16:40:34 -07:00
Util Fix indentation in ProfileFetcherJob.swift 2022-06-09 16:34:49 -05:00
SignalServiceKit.h SSK: Collapse OWSMessageUtils into OWSMessageManager 2022-04-11 15:17:39 -07:00
SSKEnvironment.h Support two SignalProtocolStores in SSKEnvironment 2022-03-16 14:31:06 -07:00
SSKEnvironment.m Support two SignalProtocolStores in SSKEnvironment 2022-03-16 14:31:06 -07:00
TSConstants.swift Clean up donate URL code 2022-04-21 12:23:37 -05:00
TSPrefix.h Change phone number. 2021-11-19 14:28:18 -03:00