Skip to content

Commit 1876f20

Browse files
authored
Add "unref" to timers (#3396)
* chore: add unref to timer see https://nodejs.org/api/timers.html#timeoutunref * chore: add unref to timer see https://nodejs.org/api/timers.html#timeoutunref * fix: lint * fix: lint * fix: lint * fix: lint
1 parent 88311c1 commit 1876f20

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

packages/pg-pool/index.js

+4
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,10 @@ class Pool extends EventEmitter {
205205
response.callback(new Error('timeout exceeded when trying to connect'))
206206
}, this.options.connectionTimeoutMillis)
207207

208+
if (tid.unref) {
209+
tid.unref()
210+
}
211+
208212
this._pendingQueue.push(pendingItem)
209213
return result
210214
}

packages/pg/lib/client.js

+4
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,10 @@ class Client extends EventEmitter {
104104
con._ending = true
105105
con.stream.destroy(new Error('timeout expired'))
106106
}, this._connectionTimeoutMillis)
107+
108+
if (this.connectionTimeoutHandle.unref) {
109+
this.connectionTimeoutHandle.unref()
110+
}
107111
}
108112

109113
if (this.host && this.host.indexOf('/') === 0) {

0 commit comments

Comments
 (0)