Skip to content

Commit 86d31a6

Browse files
authored
Only call client.ref if it exists
* Only call client.ref if it exists. Fixes #2582 * Make test requiring port less flakey * Bump port range Fixes #2582 Fixes #2584
1 parent f3b0ee4 commit 86d31a6

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

packages/pg-pool/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ class Pool extends EventEmitter {
137137
const idleItem = this._idle.pop()
138138
clearTimeout(idleItem.timeoutId)
139139
const client = idleItem.client
140-
client.ref()
140+
client.ref && client.ref()
141141
const idleListener = idleItem.idleListener
142142

143143
return this._acquireClient(client, pendingItem, idleListener, false)

packages/pg/test/integration/client/connection-timeout-tests.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ const suite = new helper.Suite()
77

88
const options = {
99
host: 'localhost',
10-
port: 54321,
10+
port: Math.floor(Math.random() * 2000) + 2000,
1111
connectionTimeoutMillis: 2000,
1212
user: 'not',
1313
database: 'existing',

0 commit comments

Comments
 (0)