Skip to content

Commit

Permalink
remove timeout references
Browse files Browse the repository at this point in the history
  • Loading branch information
W-A-James committed Jun 5, 2024
1 parent 4149b32 commit 8bcff1f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
1 change: 0 additions & 1 deletion src/operations/execute_operation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,6 @@ async function retryOperation<
// select a new server, and attempt to retry the operation
const server = await topology.selectServer(selector, {
session,
timeout: operation.timeout,
operationName: operation.commandName,
previousServer,
timeoutContext: operation.timeoutContext
Expand Down
7 changes: 2 additions & 5 deletions src/sdam/topology.ts
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,6 @@ export interface SelectServerOptions {
session?: ClientSession;
operationName: string;
previousServer?: ServerDescription;
/** @internal*/
timeout?: Timeout;
/** @internal */
timeoutContext?: TimeoutContext;
}
Expand Down Expand Up @@ -463,8 +461,6 @@ export class Topology extends TypedEventEmitter<TopologyEvents> {
const serverSelectionTimeoutMS = this.client.options.serverSelectionTimeoutMS;
const readPreference = options.readPreference ?? ReadPreference.primary;

// TODO: figure out if there is a way we can remove this and use the command that initiated the
// autoconnect's timeoutContext
const timeoutContext = TimeoutContext.create({
timeoutMS,
serverSelectionTimeoutMS,
Expand Down Expand Up @@ -574,6 +570,7 @@ export class Topology extends TypedEventEmitter<TopologyEvents> {
);
}
let timeout;
// TODO: make timeoutContext required
if (options.timeoutContext) timeout = options.timeoutContext.serverSelectionTimeout;
else {
timeout = Timeout.expires(options.serverSelectionTimeoutMS ?? 0);
Expand All @@ -600,7 +597,7 @@ export class Topology extends TypedEventEmitter<TopologyEvents> {
)
);
}
if (timeout !== options.timeout) timeout?.clear();
if (options.timeoutContext?.clearServerSelectionTimeout) timeout?.clear();
return transaction.server;
}

Expand Down

0 comments on commit 8bcff1f

Please sign in to comment.