Skip to content

Commit

Permalink
fix: The removeIdleTimeoutConnectionsTimer did not clean up when the … (
Browse files Browse the repository at this point in the history
#2384)

* fix: The removeIdleTimeoutConnectionsTimer did not clean up when the pool was closed.

* test: when the pool is closed, it should clean up timers.
  • Loading branch information
foxling committed Jan 18, 2024
1 parent ba8fafb commit 18a44f6
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 1 deletion.
1 change: 1 addition & 0 deletions lib/pool.js
Expand Up @@ -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) {
Expand Down
1 change: 0 additions & 1 deletion test/integration/test-pool-release-idle-connection.js
Expand Up @@ -38,7 +38,6 @@ pool.getConnection((err1, connection1) => {
connection4.release();
connection4.destroy();
pool.end();
setTimeout(() => process.exit(0), 1000);
});
}, 7000);
});
Expand Down

1 comment on commit 18a44f6

@danigomez
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, could that code bug cause the error reported on #2325?

Please sign in to comment.