File tree Expand file tree Collapse file tree 2 files changed +17
-17
lines changed Expand file tree Collapse file tree 2 files changed +17
-17
lines changed Original file line number Diff line number Diff line change @@ -444,22 +444,20 @@ export abstract class AbstractCursor<
444
444
throw new MongoCursorExhaustedError ( ) ;
445
445
}
446
446
447
- try {
448
- do {
449
- const doc = this . documents ?. shift ( this . cursorOptions ) ;
450
- if ( doc != null ) {
451
- if ( this . transform != null ) return await this . transformDocument ( doc ) ;
452
- return doc ;
453
- }
454
- await this . fetchBatch ( ) ;
455
- } while ( ! this . isDead || ( this . documents ?. length ?? 0 ) !== 0 ) ;
447
+ if ( this . cursorOptions . timeoutMode === CursorTimeoutMode . ITERATION ) {
448
+ this . timeoutContext ?. refresh ( ) ;
449
+ }
456
450
457
- return null ;
458
- } finally {
459
- if ( this . cursorOptions . timeoutMode === CursorTimeoutMode . ITERATION ) {
460
- this . timeoutContext ?. refresh ( ) ;
451
+ do {
452
+ const doc = this . documents ?. shift ( this . cursorOptions ) ;
453
+ if ( doc != null ) {
454
+ if ( this . transform != null ) return await this . transformDocument ( doc ) ;
455
+ return doc ;
461
456
}
462
- }
457
+ await this . fetchBatch ( ) ;
458
+ } while ( ! this . isDead || ( this . documents ?. length ?? 0 ) !== 0 ) ;
459
+
460
+ return null ;
463
461
}
464
462
465
463
/**
Original file line number Diff line number Diff line change @@ -87,6 +87,7 @@ export class Timeout extends Promise<never> {
87
87
clear ( ) : void {
88
88
clearTimeout ( this . id ) ;
89
89
this . id = undefined ;
90
+ this . timedOut = false ;
90
91
this . cleared = true ;
91
92
}
92
93
@@ -209,7 +210,6 @@ export class CSOTTimeoutContext extends TimeoutContext {
209
210
}
210
211
211
212
get maxTimeMS ( ) : number {
212
- console . log ( this . remainingTimeMS , this . minRoundTripTime ) ;
213
213
return this . remainingTimeMS - this . minRoundTripTime ;
214
214
}
215
215
@@ -282,12 +282,14 @@ export class CSOTTimeoutContext extends TimeoutContext {
282
282
this . start = Math . trunc ( performance . now ( ) ) ;
283
283
this . minRoundTripTime = 0 ;
284
284
this . _serverSelectionTimeout ?. clear ( ) ;
285
- this . _connectionCheckoutTimeout ?. clear ( ) ;
285
+ this . _serverSelectionTimeout = undefined ;
286
+ this . _connectionCheckoutTimeout = undefined ;
286
287
}
287
288
288
289
clear ( ) : void {
289
290
this . _serverSelectionTimeout ?. clear ( ) ;
290
- this . _connectionCheckoutTimeout ?. clear ( ) ;
291
+ this . _serverSelectionTimeout = undefined ;
292
+ this . _connectionCheckoutTimeout = undefined ;
291
293
}
292
294
}
293
295
You can’t perform that action at this time.
0 commit comments