Skip to content

Commit 5f70444

Browse files
committed
remove timeout references
1 parent ee851a2 commit 5f70444

File tree

2 files changed

+2
-6
lines changed

2 files changed

+2
-6
lines changed

src/operations/execute_operation.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,6 @@ async function retryOperation<
275275
// select a new server, and attempt to retry the operation
276276
const server = await topology.selectServer(selector, {
277277
session,
278-
timeout: operation.timeout,
279278
operationName: operation.commandName,
280279
previousServer,
281280
timeoutContext: operation.timeoutContext

src/sdam/topology.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -178,8 +178,6 @@ export interface SelectServerOptions {
178178
session?: ClientSession;
179179
operationName: string;
180180
previousServer?: ServerDescription;
181-
/** @internal*/
182-
timeout?: Timeout;
183181
/** @internal */
184182
timeoutContext?: TimeoutContext;
185183
}
@@ -463,8 +461,6 @@ export class Topology extends TypedEventEmitter<TopologyEvents> {
463461
const serverSelectionTimeoutMS = this.client.options.serverSelectionTimeoutMS;
464462
const readPreference = options.readPreference ?? ReadPreference.primary;
465463

466-
// TODO: figure out if there is a way we can remove this and use the command that initiated the
467-
// autoconnect's timeoutContext
468464
const timeoutContext = TimeoutContext.create({
469465
timeoutMS,
470466
serverSelectionTimeoutMS,
@@ -574,6 +570,7 @@ export class Topology extends TypedEventEmitter<TopologyEvents> {
574570
);
575571
}
576572
let timeout;
573+
// TODO: make timeoutContext required
577574
if (options.timeoutContext) timeout = options.timeoutContext.serverSelectionTimeout;
578575
else {
579576
timeout = Timeout.expires(options.serverSelectionTimeoutMS ?? 0);
@@ -600,7 +597,7 @@ export class Topology extends TypedEventEmitter<TopologyEvents> {
600597
)
601598
);
602599
}
603-
if (timeout !== options.timeout) timeout?.clear();
600+
if (options.timeoutContext?.clearServerSelectionTimeout) timeout?.clear();
604601
return transaction.server;
605602
}
606603

0 commit comments

Comments
 (0)