Make sure DB views are ready before kicking processing job

// FREEBIE
pull/1/head
Michael Kirk 8 years ago
parent 0b38b46683
commit a196693425

@ -517,9 +517,6 @@ static NSString *const kURLHostVerifyPrefix = @"verify";
// This will fetch new messages, if we're using domain // This will fetch new messages, if we're using domain
// fronting. // fronting.
[[PushManager sharedManager] applicationDidBecomeActive]; [[PushManager sharedManager] applicationDidBecomeActive];
// If there were any messages in our local queue which we hadn't yet processed.
[[OWSMessageReceiver sharedInstance] handleAnyUnprocessedEnvelopes];
}]; }];
DDLogInfo(@"%@ applicationDidBecomeActive completed.", self.tag); DDLogInfo(@"%@ applicationDidBecomeActive completed.", self.tag);
@ -796,6 +793,9 @@ static NSString *const kURLHostVerifyPrefix = @"verify";
[AppVersion.instance appLaunchDidComplete]; [AppVersion.instance appLaunchDidComplete];
[self ensureRootViewController]; [self ensureRootViewController];
// If there were any messages in our local queue which we hadn't yet processed.
[[OWSMessageReceiver sharedInstance] handleAnyUnprocessedEnvelopesAsync];
} }
- (void)ensureRootViewController - (void)ensureRootViewController

@ -13,7 +13,7 @@ NS_ASSUME_NONNULL_BEGIN
+ (void)syncRegisterDatabaseExtension:(YapDatabase *)database; + (void)syncRegisterDatabaseExtension:(YapDatabase *)database;
- (void)handleReceivedEnvelope:(OWSSignalServiceProtosEnvelope *)envelope; - (void)handleReceivedEnvelope:(OWSSignalServiceProtosEnvelope *)envelope;
- (void)handleAnyUnprocessedEnvelopes; - (void)handleAnyUnprocessedEnvelopesAsync;
@end @end

@ -335,7 +335,7 @@ NSString *const OWSMessageProcessingJobFinderExtensionGroup = @"OWSMessageProces
#pragma mark - instance methods #pragma mark - instance methods
- (void)handleAnyUnprocessedEnvelopes - (void)handleAnyUnprocessedEnvelopesAsync
{ {
dispatch_async(dispatch_get_main_queue(), ^{ dispatch_async(dispatch_get_main_queue(), ^{
[self.processingQueue drainQueue]; [self.processingQueue drainQueue];

Loading…
Cancel
Save