Fix breakage in tests around db extension registration.
This commit is contained in:
parent
b9428471cf
commit
e691ede0cf
@ -131,11 +131,27 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
- (void)configure
|
||||
{
|
||||
[self.databaseStorage clearGRDBStorageForTests];
|
||||
|
||||
__block dispatch_semaphore_t semaphore = dispatch_semaphore_create(0);
|
||||
[OWSStorage registerExtensionsWithMigrationBlock:^() {
|
||||
dispatch_semaphore_signal(semaphore);
|
||||
}];
|
||||
dispatch_semaphore_wait(semaphore, DISPATCH_TIME_FOREVER);
|
||||
|
||||
// Registering extensions is a complicated process than can move
|
||||
// on and off the main thread. While we wait for it to complete,
|
||||
// we need to process the run loop so that the work on the main
|
||||
// thread can be completed.
|
||||
while (YES) {
|
||||
// Wait up to 10 ms.
|
||||
BOOL success
|
||||
= dispatch_semaphore_wait(semaphore, dispatch_time(DISPATCH_TIME_NOW, (int64_t)(10 * NSEC_PER_MSEC))) == 0;
|
||||
if (success) {
|
||||
break;
|
||||
}
|
||||
|
||||
// Process a single "source" (e.g. item) on the default run loop.
|
||||
CFRunLoopRunInMode(kCFRunLoopDefaultMode, 0.0, false);
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
Loading…
Reference in New Issue
Block a user