Skip to content

Commit 75227d9

Browse files
committed
feat(NODE-7020): remove ping on connect
1 parent be7f808 commit 75227d9

File tree

1 file changed

+3
-10
lines changed

1 file changed

+3
-10
lines changed

src/sdam/topology.ts

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ import {
4646
makeStateMachine,
4747
noop,
4848
now,
49-
ns,
5049
promiseWithResolvers,
5150
shuffle
5251
} from '../utils';
@@ -469,15 +468,9 @@ export class Topology extends TypedEventEmitter<TopologyEvents> {
469468
readPreferenceServerSelector(readPreference),
470469
selectServerOptions
471470
);
472-
const skipPingOnConnect = this.s.options.__skipPingOnConnect === true;
473-
if (!skipPingOnConnect && this.s.credentials) {
474-
await server.command(ns('admin.$cmd'), { ping: 1 }, { timeoutContext });
475-
stateTransition(this, STATE_CONNECTED);
476-
this.emit(Topology.OPEN, this);
477-
this.emit(Topology.CONNECT, this);
478-
479-
return this;
480-
}
471+
472+
const connection = await server.pool.checkOut({ timeoutContext: timeoutContext });
473+
server.pool.checkIn(connection);
481474

482475
stateTransition(this, STATE_CONNECTED);
483476
this.emit(Topology.OPEN, this);

0 commit comments

Comments
 (0)