File tree 1 file changed +3
-3
lines changed
1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -312,14 +312,16 @@ class Topology extends EventEmitter {
312
312
}
313
313
314
314
options = options || { } ;
315
- if ( this . s . state === STATE_CLOSED ) {
315
+ if ( this . s . state === STATE_CLOSED || this . s . state === STATE_CLOSING ) {
316
316
if ( typeof callback === 'function' ) {
317
317
callback ( ) ;
318
318
}
319
319
320
320
return ;
321
321
}
322
322
323
+ stateTransition ( this , STATE_CLOSING ) ;
324
+
323
325
drainWaitQueue ( this [ kWaitQueue ] , new MongoError ( 'Topology closed' ) ) ;
324
326
drainTimerQueue ( this . s . connectionTimers ) ;
325
327
@@ -336,8 +338,6 @@ class Topology extends EventEmitter {
336
338
delete this . s . detectTopologyDescriptionChange ;
337
339
}
338
340
339
- stateTransition ( this , STATE_CLOSING ) ;
340
-
341
341
this . s . sessions . forEach ( session => session . endSession ( ) ) ;
342
342
this . s . sessionPool . endAllPooledSessions ( ( ) => {
343
343
eachAsync (
You can’t perform that action at this time.
0 commit comments