FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Use _isFull instead of duplicating clients check (#2539) · brianc/node-postgres@9d2c977 · GitHub

Repository navigation

Commit 9d2c977

Browse files
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 a040031 commit 9d2c977

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎packages/pg-pool/index.js‎

Lines changed: 1 addition & 1 deletion
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)

Back | FazBrowse Home | New Git URL