File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff 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];
You can’t perform that action at this time.
0 commit comments