File tree Expand file tree Collapse file tree 2 files changed +2
-6
lines changed Expand file tree Collapse file tree 2 files changed +2
-6
lines changed Original file line number Diff line number Diff line change @@ -275,7 +275,6 @@ async function retryOperation<
275
275
// select a new server, and attempt to retry the operation
276
276
const server = await topology . selectServer ( selector , {
277
277
session,
278
- timeout : operation . timeout ,
279
278
operationName : operation . commandName ,
280
279
previousServer,
281
280
timeoutContext : operation . timeoutContext
Original file line number Diff line number Diff line change @@ -178,8 +178,6 @@ export interface SelectServerOptions {
178
178
session ?: ClientSession ;
179
179
operationName : string ;
180
180
previousServer ?: ServerDescription ;
181
- /** @internal */
182
- timeout ?: Timeout ;
183
181
/** @internal */
184
182
timeoutContext ?: TimeoutContext ;
185
183
}
@@ -463,8 +461,6 @@ export class Topology extends TypedEventEmitter<TopologyEvents> {
463
461
const serverSelectionTimeoutMS = this . client . options . serverSelectionTimeoutMS ;
464
462
const readPreference = options . readPreference ?? ReadPreference . primary ;
465
463
466
- // TODO: figure out if there is a way we can remove this and use the command that initiated the
467
- // autoconnect's timeoutContext
468
464
const timeoutContext = TimeoutContext . create ( {
469
465
timeoutMS,
470
466
serverSelectionTimeoutMS,
@@ -574,6 +570,7 @@ export class Topology extends TypedEventEmitter<TopologyEvents> {
574
570
) ;
575
571
}
576
572
let timeout ;
573
+ // TODO: make timeoutContext required
577
574
if ( options . timeoutContext ) timeout = options . timeoutContext . serverSelectionTimeout ;
578
575
else {
579
576
timeout = Timeout . expires ( options . serverSelectionTimeoutMS ?? 0 ) ;
@@ -600,7 +597,7 @@ export class Topology extends TypedEventEmitter<TopologyEvents> {
600
597
)
601
598
) ;
602
599
}
603
- if ( timeout !== options . timeout ) timeout ?. clear ( ) ;
600
+ if ( options . timeoutContext ?. clearServerSelectionTimeout ) timeout ?. clear ( ) ;
604
601
return transaction . server ;
605
602
}
606
603
You can’t perform that action at this time.
0 commit comments