From 49d723593d95e090161fee309d552f9854705588 Mon Sep 17 00:00:00 2001 From: Matt Broadstone Date: Wed, 30 Oct 2019 15:53:09 -0400 Subject: [PATCH] fix(sdam): ignore server errors when closing/closed --- lib/core/sdam/topology.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/core/sdam/topology.js b/lib/core/sdam/topology.js index 5aa5df773f..35f241144e 100644 --- a/lib/core/sdam/topology.js +++ b/lib/core/sdam/topology.js @@ -1039,8 +1039,12 @@ function serverConnectEventHandler(server, topology) { }; } -function serverErrorEventHandler(server /*, topology */) { +function serverErrorEventHandler(server, topology) { return function(err) { + if (topology.s.state === STATE_CLOSING || topology.s.state === STATE_CLOSED) { + return; + } + if (isSDAMUnrecoverableError(err, server)) { resetServerState(server, err, { clearPool: true }); return;