From 43d461e833da96b2426e64d4178e3dc21a301d35 Mon Sep 17 00:00:00 2001 From: Matt Broadstone Date: Fri, 1 Nov 2019 14:48:46 -0400 Subject: [PATCH] fix(pool): only transition to `DISCONNECTED` if reconnect enabled --- lib/core/connection/pool.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/core/connection/pool.js b/lib/core/connection/pool.js index 8e20814223..318f5fbe42 100644 --- a/lib/core/connection/pool.js +++ b/lib/core/connection/pool.js @@ -273,7 +273,9 @@ function connectionFailureHandler(pool, event, err, conn) { // No more socket available propegate the event if (pool.socketCount() === 0) { if (pool.state !== DESTROYED && pool.state !== DESTROYING && pool.state !== DRAINING) { - stateTransition(pool, DISCONNECTED); + if (pool.options.reconnect) { + stateTransition(pool, DISCONNECTED); + } } // Do not emit error events, they are always close events