File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed
modules/module-mongodb-storage/src/storage/implementation Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -695,9 +695,14 @@ export class MongoSyncBucketStorage
695
695
while ( true ) {
696
696
// If the stream is idle, we wait a max of a minute (CHECKPOINT_TIMEOUT_MS)
697
697
// before we get another checkpoint, to avoid stale checkpoint snapshots.
698
- const timeout = timers . setTimeout ( CHECKPOINT_TIMEOUT_MS , null , { signal } ) ;
698
+ const timeout = timers
699
+ . setTimeout ( CHECKPOINT_TIMEOUT_MS , { done : false } , { signal } )
700
+ . catch ( ( ) => ( { done : true } ) ) ;
699
701
try {
700
- await Promise . race ( [ stream . next ( ) , timeout ] ) ;
702
+ const result = await Promise . race ( [ stream . next ( ) , timeout ] ) ;
703
+ if ( result . done ) {
704
+ break ;
705
+ }
701
706
} catch ( e ) {
702
707
if ( e . name == 'AbortError' ) {
703
708
break ;
@@ -706,6 +711,7 @@ export class MongoSyncBucketStorage
706
711
}
707
712
708
713
if ( signal . aborted ) {
714
+ // Would likely have been caught by the signal on the timeout or the upstream stream, but we check here anyway
709
715
break ;
710
716
}
711
717
You can’t perform that action at this time.
0 commit comments