mirror of
https://github.com/oxen-io/session-ios.git
synced 2023-12-13 21:30:14 +01:00
Decrypt and process messages in batches.
// FREEBIE
This commit is contained in:
parent
9987ebb3c0
commit
e39b9169b9
4 changed files with 18 additions and 9 deletions
|
@ -299,8 +299,7 @@ NSString *const OWSBatchMessageProcessingJobFinderExtensionGroup = @"OWSBatchMes
|
|||
{
|
||||
AssertIsOnMainThread();
|
||||
|
||||
const NSUInteger kMaxBatchSize = 10;
|
||||
NSArray<OWSBatchMessageProcessingJob *> *jobs = [self.finder nextJobsForBatchSize:kMaxBatchSize];
|
||||
NSArray<OWSBatchMessageProcessingJob *> *jobs = [self.finder nextJobsForBatchSize:kIncomingMessageBatchSize];
|
||||
OWSAssert(jobs);
|
||||
if (jobs.count < 1) {
|
||||
self.isDrainingQueue = NO;
|
||||
|
|
|
@ -294,8 +294,7 @@ NSString *const OWSMessageProcessingJobFinderExtensionGroup = @"OWSMessageProces
|
|||
{
|
||||
AssertIsOnMainThread();
|
||||
|
||||
const NSUInteger kMaxBatchSize = 10;
|
||||
NSArray<OWSMessageProcessingJob *> *jobs = [self.finder nextJobsForBatchSize:kMaxBatchSize];
|
||||
NSArray<OWSMessageProcessingJob *> *jobs = [self.finder nextJobsForBatchSize:kIncomingMessageBatchSize];
|
||||
OWSAssert(jobs);
|
||||
if (jobs.count < 1) {
|
||||
self.isDrainingQueue = NO;
|
||||
|
|
|
@ -8,6 +8,8 @@
|
|||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
extern const NSUInteger kIncomingMessageBatchSize;
|
||||
|
||||
@class TSNetworkManager;
|
||||
@class TSStorageManager;
|
||||
@class OWSSignalServiceProtosEnvelope;
|
||||
|
|
|
@ -45,6 +45,15 @@
|
|||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
// We need to use a consistent batch size throughout
|
||||
// the incoming message pipeline (i.e. in the
|
||||
// "decrypt" and "process" steps), or the pipeline
|
||||
// doesn't flow smoothly.
|
||||
//
|
||||
// We want a value that is just high enough to yield
|
||||
// perf benefits. The right value is probably 5-15.
|
||||
const NSUInteger kIncomingMessageBatchSize = 10;
|
||||
|
||||
@interface TSMessagesManager ()
|
||||
|
||||
@property (nonatomic, readonly) id<OWSCallMessageHandler> callMessageHandler;
|
||||
|
@ -1087,13 +1096,13 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
}
|
||||
case OWSSignalServiceProtosGroupContextTypeDeliver: {
|
||||
if (body.length == 0 && attachmentIds.count < 1) {
|
||||
DDLogWarn(@"%@ ignoring empty incoming message from: %@ for group: %@ with timestampe: %lu",
|
||||
DDLogWarn(@"%@ ignoring empty incoming message from: %@ for group: %@ with timestamp: %lu",
|
||||
self.tag,
|
||||
envelopeAddress(envelope),
|
||||
groupId,
|
||||
(unsigned long)timestamp);
|
||||
} else {
|
||||
DDLogDebug(@"%@ incoming message from: %@ for group: %@ with timestampe: %lu",
|
||||
DDLogDebug(@"%@ incoming message from: %@ for group: %@ with timestamp: %lu",
|
||||
self.tag,
|
||||
envelopeAddress(envelope),
|
||||
groupId,
|
||||
|
@ -1111,19 +1120,19 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
break;
|
||||
}
|
||||
default: {
|
||||
DDLogWarn(@"%@ Ignoring unknown group message type:%d", self.tag, (int)dataMessage.group.type);
|
||||
DDLogWarn(@"%@ Ignoring unknown group message type: %d", self.tag, (int)dataMessage.group.type);
|
||||
}
|
||||
}
|
||||
|
||||
thread = gThread;
|
||||
} else {
|
||||
if (body.length == 0 && attachmentIds.count < 1) {
|
||||
DDLogWarn(@"%@ ignoring empty incoming message from: %@ with timestampe: %lu",
|
||||
DDLogWarn(@"%@ ignoring empty incoming message from: %@ with timestamp: %lu",
|
||||
self.tag,
|
||||
envelopeAddress(envelope),
|
||||
(unsigned long)timestamp);
|
||||
} else {
|
||||
DDLogDebug(@"%@ incoming message from: %@ with timestampe: %lu",
|
||||
DDLogDebug(@"%@ incoming message from: %@ with timestamp: %lu",
|
||||
self.tag,
|
||||
envelopeAddress(envelope),
|
||||
(unsigned long)timestamp);
|
||||
|
|
Loading…
Reference in a new issue