Skip to content

Commit f6a74eb

Browse files
committed
add option poolReturnToHead which is passed through to genericPool
add option `poolReturnToHead` to facilitate reduction of pool size after demand recedes. As the current round robin check now keeps on touching all the connections and never lets them expire under decent traffic.
1 parent 715e500 commit f6a74eb

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

lib/defaults.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ var defaults = module.exports = {
3333
//frequeny to check for idle clients within the client pool
3434
reapIntervalMillis: 1000,
3535

36+
// re-use most recent connections, allowing older connections to be reaped.
37+
poolReturnToHead: false,
38+
3639
//pool log function / boolean
3740
poolLog: false,
3841

lib/pool.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ var pools = {
2020
max: clientConfig.poolSize || defaults.poolSize,
2121
idleTimeoutMillis: clientConfig.poolIdleTimeout || defaults.poolIdleTimeout,
2222
reapIntervalMillis: clientConfig.reapIntervalMillis || defaults.reapIntervalMillis,
23+
returnToHead: clientConfig.poolReturnToHead || defaults.poolReturnToHead,
2324
log: clientConfig.poolLog || defaults.poolLog,
2425
create: function(cb) {
2526
var client = new pools.Client(clientConfig);

0 commit comments

Comments
 (0)