Skip to content

Commit 55e4fc9

Browse files
committed
Ensure removal of all idle connections in the free connection list of the connection pool (Issue #1633)
1 parent 4f96b46 commit 55e4fc9

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

doc/src/release_notes.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,11 @@ Thin Mode Changes
2323
unless the number of batch errors is a multiple of 65536; instead,
2424
the number of batch errors returned is modulo 65536.
2525

26+
#) Updated pool functionality to scan and remove idle connections from
27+
beginning of free connection list. This will ensure removal of all idle
28+
connections present in free connection list.
29+
`Issue #1633 <https://github.com/oracle/node-oracledb/issues/1633>`__.
30+
2631
Thick Mode Changes
2732
++++++++++++++++++
2833

lib/thin/pool.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -363,13 +363,13 @@ class ThinPoolImpl extends PoolImpl {
363363
_scanIdleConnection() {
364364
while ((this._usedConnectionList.size + this._freeConnectionList.length) >
365365
this._poolMin && this._freeConnectionList.length > 0) {
366-
const conn = this._freeConnectionList[this._freeConnectionList.length - 1];
366+
const conn = this._freeConnectionList[0];
367367
if (Date.now() - conn._lastTimeUsed < this._poolTimeout * 1000) {
368368
break;
369369
}
370370

371371
this.eventEmitter.emit('_removePoolConnection', conn);
372-
this._freeConnectionList.pop();
372+
this._freeConnectionList.shift();
373373
}
374374

375375
this._schedulerJob = null;

0 commit comments

Comments
 (0)