Skip to content

Commit

Permalink
fix(NODE-3521): remove extra server selection
Browse files Browse the repository at this point in the history
  • Loading branch information
durran committed Feb 25, 2022
1 parent a0dfc5b commit 3f953a1
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 19 deletions.
8 changes: 0 additions & 8 deletions src/operations/execute_operation.ts
Expand Up @@ -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<T, TResult>(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;
Expand Down
11 changes: 0 additions & 11 deletions src/sdam/topology.ts
Expand Up @@ -630,17 +630,6 @@ export class Topology extends TypedEventEmitter<TopologyEvents> {

// 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);
Expand Down

0 comments on commit 3f953a1

Please sign in to comment.