Skip to content

Commit d79eb8b

Browse files
committed
Refactor BaseConnectionPool empty method
Signed-off-by: Bandini Bhopi <[email protected]>
1 parent 9b44c61 commit d79eb8b

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

lib/pool/BaseConnectionPool.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -150,13 +150,14 @@ class BaseConnectionPool {
150150
let openConnections = this.size;
151151
this.connections.forEach((connection) => {
152152
connection.close(() => {
153-
if (--openConnections === 0) {
154-
this.connections = [];
155-
this.size = this.connections.length;
156-
callback();
157-
}
153+
openConnections--;
158154
});
159155
});
156+
if (openConnections === 0) {
157+
this.connections = [];
158+
this.size = this.connections.length;
159+
callback();
160+
}
160161
}
161162

162163
/**

0 commit comments

Comments
 (0)