Skip to content

Commit 5600af9

Browse files
committed
refactor: simplify resetServerState since reset is synchronous now
1 parent e4df5f4 commit 5600af9

File tree

1 file changed

+7
-12
lines changed

1 file changed

+7
-12
lines changed

lib/core/sdam/topology.js

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -971,21 +971,16 @@ function executeWriteOperation(args, options, callback) {
971971
function resetServerState(server, error, options) {
972972
options = Object.assign({}, { clearPool: false }, options);
973973

974-
function resetState() {
975-
server.emit(
976-
'descriptionReceived',
977-
new ServerDescription(server.description.address, null, { error })
978-
);
979-
980-
process.nextTick(() => server.requestCheck());
981-
}
982-
983974
if (options.clearPool && server.s.pool) {
984-
server.s.pool.reset(() => resetState());
985-
return;
975+
server.s.pool.clear();
986976
}
987977

988-
resetState();
978+
server.emit(
979+
'descriptionReceived',
980+
new ServerDescription(server.description.address, null, { error })
981+
);
982+
983+
process.nextTick(() => server.requestCheck());
989984
}
990985

991986
function translateReadPreference(options) {

0 commit comments

Comments
 (0)