Skip to content

Commit 9a19244

Browse files
W-A-Jamesnbbeeken
authored andcommitted
refactor(NODE-5912): refactor
1 parent 608cb83 commit 9a19244

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

src/sdam/topology.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -473,17 +473,13 @@ export class Topology extends TypedEventEmitter<TopologyEvents> {
473473

474474
const skipPingOnConnect = this.s.options[Symbol.for('@@mdb.skipPingOnConnect')] === true;
475475
if (!skipPingOnConnect && server && this.s.credentials) {
476-
server.command(ns('admin.$cmd'), { ping: 1 }, {}, err => {
477-
if (err) {
478-
return exitWithError(err);
479-
}
480-
476+
server.commandAsync(ns('admin.$cmd'), { ping: 1 }, {}).then(() => {
481477
stateTransition(this, STATE_CONNECTED);
482478
this.emit(Topology.OPEN, this);
483479
this.emit(Topology.CONNECT, this);
484480

485481
callback?.(undefined, this);
486-
});
482+
}, exitWithError);
487483

488484
return;
489485
}

0 commit comments

Comments
 (0)