Move more work off the main thread.

// FREEBIE
pull/1/head
Matthew Chen 8 years ago
parent 9573e0e16d
commit facbc56062

@ -178,9 +178,7 @@ NSString *const OWSReadReceiptManagerAreReadReceiptsEnabled = @"areReadReceiptsE
object:nil];
// Try to start processing.
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
[self scheduleProcessing];
});
return self;
}
@ -198,10 +196,12 @@ NSString *const OWSReadReceiptManagerAreReadReceiptsEnabled = @"areReadReceiptsE
// Schedules a processing pass, unless one is already scheduled.
- (void)scheduleProcessing
{
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
@synchronized(self)
{
if ([TSDatabaseView hasPendingViewRegistrations]) {
DDLogInfo(@"%@ Deferring read receipt processing due to pending database view registrations.", self.tag);
DDLogInfo(
@"%@ Deferring read receipt processing due to pending database view registrations.", self.tag);
return;
}
if (self.isProcessing) {
@ -222,6 +222,7 @@ NSString *const OWSReadReceiptManagerAreReadReceiptsEnabled = @"areReadReceiptsE
[self process];
});
}
});
}
- (void)process

Loading…
Cancel
Save