Skip to content

Commit

Permalink
Use _isFull instead of duplicating clients check (brianc#2539)
Browse files Browse the repository at this point in the history
Noticed that options.max is compared against client count directly, but there's a method wrapping it. I can't see any reason to duplicate it? And using _isFull means I can override that for the adaptive pooling idea I'm exploring :)
  • Loading branch information
gregplaysguitar authored and Bluenix2 committed Jun 22, 2021
1 parent d6ed9e7 commit a2c4002
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/pg-pool/index.js
Expand Up @@ -168,7 +168,7 @@ class Pool extends EventEmitter {
const result = response.result

// if we don't have to connect a new client, don't do so
if (this._clients.length >= this.options.max || this._idle.length) {
if (this._isFull() || this._idle.length) {
// if we have idle clients schedule a pulse immediately
if (this._idle.length) {
process.nextTick(() => this._pulseQueue())
Expand Down

0 comments on commit a2c4002

Please sign in to comment.