From 18a44f6a0a0b7ef41cc874d7a7bb2d3db83ea533 Mon Sep 17 00:00:00 2001 From: lingye Date: Thu, 18 Jan 2024 15:35:39 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20The=20removeIdleTimeoutConnectionsTimer?= =?UTF-8?q?=20did=20not=20clean=20up=20when=20the=20=E2=80=A6=20(#2384)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix: The removeIdleTimeoutConnectionsTimer did not clean up when the pool was closed. * test: when the pool is closed, it should clean up timers. --- lib/pool.js | 1 + test/integration/test-pool-release-idle-connection.js | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/pool.js b/lib/pool.js index db54a7ab76..1b4993ff1a 100644 --- a/lib/pool.js +++ b/lib/pool.js @@ -100,6 +100,7 @@ class Pool extends EventEmitter { end(cb) { this._closed = true; + clearTimeout(this._removeIdleTimeoutConnectionsTimer); if (typeof cb !== 'function') { cb = function(err) { if (err) { diff --git a/test/integration/test-pool-release-idle-connection.js b/test/integration/test-pool-release-idle-connection.js index 44da790faa..24644e6bb0 100644 --- a/test/integration/test-pool-release-idle-connection.js +++ b/test/integration/test-pool-release-idle-connection.js @@ -38,7 +38,6 @@ pool.getConnection((err1, connection1) => { connection4.release(); connection4.destroy(); pool.end(); - setTimeout(() => process.exit(0), 1000); }); }, 7000); });