From 3f953a1a58922b4fea2467efea3cd5e69aee0d46 Mon Sep 17 00:00:00 2001 From: Durran Jordan Date: Fri, 25 Feb 2022 01:41:43 +0100 Subject: [PATCH] fix(NODE-3521): remove extra server selection --- src/operations/execute_operation.ts | 8 -------- src/sdam/topology.ts | 11 ----------- 2 files changed, 19 deletions(-) diff --git a/src/operations/execute_operation.ts b/src/operations/execute_operation.ts index 00321c119d9..0565d344569 100644 --- a/src/operations/execute_operation.ts +++ b/src/operations/execute_operation.ts @@ -77,14 +77,6 @@ export function executeOperation< } return maybePromise(callback, cb => { - if (topology.shouldCheckForSessionSupport()) { - return topology.selectServer(ReadPreference.primaryPreferred, err => { - if (err) return cb(err); - - executeOperation(topology, operation, cb); - }); - } - // The driver sessions spec mandates that we implicitly create sessions for operations // that are not explicitly provided with a session. let session: ClientSession | undefined = operation.session; diff --git a/src/sdam/topology.ts b/src/sdam/topology.ts index 5a49257e98a..e3018b1f487 100644 --- a/src/sdam/topology.ts +++ b/src/sdam/topology.ts @@ -630,17 +630,6 @@ export class Topology extends TypedEventEmitter { // Sessions related methods - /** - * @returns Whether the topology should initiate selection to determine session support - */ - shouldCheckForSessionSupport(): boolean { - if (this.description.type === TopologyType.Single) { - return !this.description.hasKnownServers; - } - - return !this.description.hasDataBearingServers; - } - /** Start a logical session */ startSession(options: ClientSessionOptions, clientOptions?: MongoOptions): ClientSession { const session = new ClientSession(this, this.s.sessionPool, options, clientOptions);