Skip to content

Commit

Permalink
Only call client.ref if it exists
Browse files Browse the repository at this point in the history
* Only call client.ref if it exists. Fixes #2582

* Make test requiring port less flakey

* Bump port range

Fixes #2582
Fixes #2584
  • Loading branch information
brianc committed Jul 27, 2021
1 parent f3b0ee4 commit 86d31a6
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/pg-pool/index.js
Expand Up @@ -137,7 +137,7 @@ class Pool extends EventEmitter {
const idleItem = this._idle.pop()
clearTimeout(idleItem.timeoutId)
const client = idleItem.client
client.ref()
client.ref && client.ref()
const idleListener = idleItem.idleListener

return this._acquireClient(client, pendingItem, idleListener, false)
Expand Down
Expand Up @@ -7,7 +7,7 @@ const suite = new helper.Suite()

const options = {
host: 'localhost',
port: 54321,
port: Math.floor(Math.random() * 2000) + 2000,
connectionTimeoutMillis: 2000,
user: 'not',
database: 'existing',
Expand Down

0 comments on commit 86d31a6

Please sign in to comment.