File tree Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -583,12 +583,14 @@ export class Topology extends TypedEventEmitter<TopologyEvents> {
583
583
}
584
584
585
585
const { promise : serverPromise , resolve, reject } = promiseWithResolvers < Server > ( ) ;
586
- console . log ( options . timeout ?. remainingTime , options . serverSelectionTimeoutMS ) ;
587
- const timeout = options . timeout
588
- ? Timeout . expires (
589
- Timeout . min ( options . timeout . remainingTime , options . serverSelectionTimeoutMS ?? 0 )
590
- )
591
- : Timeout . expires ( options . serverSelectionTimeoutMS ?? 0 ) ;
586
+ const serverSelectionTimeoutMS = options . serverSelectionTimeoutMS ?? 0 ;
587
+ let timeout : Timeout ;
588
+ if ( options . timeout && options . timeout . remainingTime < serverSelectionTimeoutMS ) {
589
+ timeout = options . timeout ;
590
+ } else {
591
+ timeout = Timeout . expires ( serverSelectionTimeoutMS ) ;
592
+ }
593
+
592
594
const waitQueueMember : ServerSelectionRequest = {
593
595
serverSelector,
594
596
topologyDescription : this . description ,
You can’t perform that action at this time.
0 commit comments