Skip to content

Commit d88e097

Browse files
Copilotmariuz
andcommitted
Fix pool dbinuse counter: Always decrement when connection is returned
Co-authored-by: mariuz <18359+mariuz@users.noreply.github.com>
1 parent 84d9e3a commit d88e097

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

lib/pool.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,9 @@ class Pool {
4747
else
4848
self.pooldb.push(db);
4949

50-
if (db.connection._pooled)
51-
self.dbinuse--;
50+
// Always decrement dbinuse when a pooled connection is returned
51+
// This connection was counted in dbinuse when given out (line 33)
52+
self.dbinuse--;
5253
self.check();
5354
});
5455
} else {

0 commit comments

Comments
 (0)