diff --git a/lib/core/sdam/monitor.js b/lib/core/sdam/monitor.js index c798775c06..79bc6d0ac1 100644 --- a/lib/core/sdam/monitor.js +++ b/lib/core/sdam/monitor.js @@ -118,7 +118,8 @@ class Monitor extends EventEmitter { } reset() { - if (isInCloseState(this)) { + const topologyVersion = this[kServer].description.topologyVersion; + if (isInCloseState(this) || topologyVersion == null) { return; } @@ -152,7 +153,6 @@ class Monitor extends EventEmitter { } function resetMonitorState(monitor) { - stateTransition(monitor, STATE_CLOSING); if (monitor[kMonitorId]) { monitor[kMonitorId].stop(); monitor[kMonitorId] = null;