Skip to content

Commit

Permalink
Merge pull request #20 from CartoDB/better-configuration-management
Browse files Browse the repository at this point in the history
fix: use current options provided by the generic pool module
  • Loading branch information
dgaubert authored Jan 7, 2021
2 parents 9417078 + 864d40f commit 949757c
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 6 deletions.
5 changes: 5 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# 0.8.2 (2021-01-07)

### Fixed
- Fix pool options

# 0.8.1 (2020-08-20)

### Added
Expand Down
28 changes: 22 additions & 6 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,23 @@ const { createPool } = require('generic-pool');
const FLUSH_CONNECTION = true;
const DEFAULT_STATUS_INTERVAL = 60000
const DEFAULTS = {
name: 'default',
host: '127.0.0.1',
port: '6379',
max: 50,
max: 8,
min: 1,
maxWaitingClients: 8,
testOnBorrow: false,
acquireTimeoutMillis: 3000,
fifo: true,
priorityRange: 1,
autostart: true,
evictionRunIntervalMillis: 60000,
numTestsPerEvictionRun: 8,
idleTimeoutMillis: 10000,
reapIntervalMillis: 1000,
softIdleTimeoutMillis: -1,
noReadyCheck: false,
returnToHead: false,
unwatchOnRelease: true,
name: 'default',
slowPool: {
log: false,
elapsedThreshold: 25
Expand Down Expand Up @@ -203,9 +211,17 @@ function makePool (redisPool, database) {

const config = {
max: redisPool.options.max,
min: redisPool.options.min,
maxWaitingClients: redisPool.options.maxWaitingClients,
testOnBorrow: redisPool.options.testOnBorrow,
acquireTimeoutMillis: redisPool.options.acquireTimeoutMillis,
fifo: redisPool.options.fifo,
priorityRange: redisPool.options.priorityRange,
autostart: redisPool.options.autostart,
evictionRunIntervalMillis: redisPool.options.evictionRunIntervalMillis,
numTestsPerEvictionRun: redisPool.options.numTestsPerEvictionRun,
idleTimeoutMillis: redisPool.options.idleTimeoutMillis,
reapIntervalMillis: redisPool.options.reapIntervalMillis,
returnToHead: redisPool.options.returnToHead
softIdleTimeoutMillis: redisPool.options.softIdleTimeoutMillis
};

return createPool(factory, config);
Expand Down

0 comments on commit 949757c

Please sign in to comment.