Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 8fe95f2

Browse files
Add timeout
1 parent 5d31027 commit 8fe95f2

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

‎ios/Firestack/FirestackDatabase.m‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -481,8 +481,12 @@ - (id) init
481481
}];
482482
});
483483
// Wait for the event handler to call tryCommitTransaction
484-
dispatch_semaphore_wait(sema, DISPATCH_TIME_FOREVER);
485-
BOOL abort = [transactionState valueForKey:@"abort"];
484+
// WARNING: This wait occurs on the Firebase Worker Queue
485+
// so if tryCommitTransaction fails to signal the semaphore
486+
// no further blocks will be executed by Firebase until the timeout expires
487+
dispatch_time_t delayTime = dispatch_time(DISPATCH_TIME_NOW, 30 * NSEC_PER_SEC);
488+
BOOL timedout = dispatch_semaphore_wait(sema, delayTime) != 0;
489+
BOOL abort = [transactionState valueForKey:@"abort"] || timedout;
486490
id value = [transactionState valueForKey:@"value"];
487491
dispatch_barrier_async(_transactionQueue, ^{
488492
[_transactions removeObjectForKey:identifier];

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /