File tree Expand file tree Collapse file tree 2 files changed +8
-8
lines changed
test/integration/node-specific Expand file tree Collapse file tree 2 files changed +8
-8
lines changed Original file line number Diff line number Diff line change @@ -559,6 +559,11 @@ export class Topology extends TypedEventEmitter<TopologyEvents> {
559559 new ServerSelectionStartedEvent ( selector , this . description , options . operationName )
560560 ) ;
561561 }
562+ let timeout ;
563+ if ( options . timeoutContext ) timeout = options . timeoutContext . serverSelectionTimeout ;
564+ else {
565+ timeout = Timeout . expires ( options . serverSelectionTimeoutMS ?? 0 ) ;
566+ }
562567
563568 const isSharded = this . description . type === TopologyType . Sharded ;
564569 const session = options . session ;
@@ -581,16 +586,10 @@ export class Topology extends TypedEventEmitter<TopologyEvents> {
581586 )
582587 ) ;
583588 }
584-
589+ if ( options . timeoutContext ?. clearServerSelectionTimeout ) timeout ?. clear ( ) ;
585590 return transaction . server ;
586591 }
587592
588- let timeout ;
589- if ( options . timeoutContext ) timeout = options . timeoutContext . serverSelectionTimeout ;
590- else {
591- timeout = Timeout . expires ( options . serverSelectionTimeoutMS ?? 0 ) ;
592- }
593-
594593 const { promise : serverPromise , resolve, reject } = promiseWithResolvers < Server > ( ) ;
595594
596595 const waitQueueMember : ServerSelectionRequest = {
Original file line number Diff line number Diff line change @@ -793,8 +793,9 @@ describe('AbortSignal support', () => {
793793 describe ( 'if reauth throws' , ( ) => {
794794 beforeEach ( ( ) => {
795795 sinon . stub ( ConnectionPool . prototype , 'reauthenticate' ) . callsFake ( async function ( ) {
796+ const error = new Error ( 'Rejecting reauthenticate for testing' ) ;
796797 await sleep ( 1000 ) ;
797- throw new Error ( 'Rejecting reauthenticate for testing' ) ;
798+ throw error ;
798799 } ) ;
799800 } ) ;
800801
You can’t perform that action at this time.
0 commit comments