Skip to content

Commit a2c4002

Browse files
gregplaysguitarBluenix2
authored andcommitted
Use _isFull instead of duplicating clients check (#2539)
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 :)
1 parent d6ed9e7 commit a2c4002

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Diff for: packages/pg-pool/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ class Pool extends EventEmitter {
168168
const result = response.result
169169

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

0 commit comments

Comments
 (0)