- Matthew suggested moving all polite readiness blocks to their
impolite variants. There shouldn't be ordering concerns and message
processing is important enough to be run impolitely.
- Nora suggested moving some of the message processing checks into
MessagePipelineSupervisor. Some of the more complex checks like
registration are out of scope of this change. But -[AppContext
shouldProcessIncomingMessages] is a minor enough change to include.
Now, -shouldProcessIncomingMessages is a precondition for
-isMessageProcessingPermitted
- Matthew suggested that GRDB failures should be fatal. So instead,
AnySignalRecipientFinder will try! instead of try?.
- Matthew suggested moving some of the MessagePipelineSupervisor
logging statements to be lower priority.
- Adopt a local dependency property to fit in with existing style
- Unregister from pipeline supervision in some pipeline stages. This
usually shouldn't matter since they're all singletons/children of
singletons. I've only added this to classes that are already
unregistering existing observations, or don't have any existing
observations. Anything that was registering and not unregistering,
I've left as is.
Creates a new root singleton: OWSMessagePipelineSupervisor
As of right now, this singleton has two responsibilities:
- Track all message processing pipeline stages that have registered
themselves
- Post processing suspension updates to interested stages
Four classes will now register themselves as pipeline stages:
- OWSMessageContentQueue
- YAPDBMessageDecryptQueue
- IncomingGroupsV2MessageQueue
- SSKMessageDecryptJobQueue
At initialization, OWSMessagePipelineSupervisor will take out a pipeline
suspension while it waits for a UUIDBackfillTask to complete. Other
interested objects are also able to suspend the message processing
pipeline by invoking suspendMessageProcessing(for:) on the supervisor
(though, currently this is not used by anything except tests)
This also adds some supporting improvements to UnfairLock. Now,
UnfairLock closures will return the value returned from its critical
section closure.