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
This commit is contained in:
francesco 2025-03-10 18:16:57 +01:00 committed by GitHub
parent 88311c17a5
commit 1876f2000a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 8 additions and 0 deletions

View File

@ -205,6 +205,10 @@ class Pool extends EventEmitter {
response.callback(new Error('timeout exceeded when trying to connect'))
}, this.options.connectionTimeoutMillis)
if (tid.unref) {
tid.unref()
}
this._pendingQueue.push(pendingItem)
return result
}

View File

@ -104,6 +104,10 @@ class Client extends EventEmitter {
con._ending = true
con.stream.destroy(new Error('timeout expired'))
}, this._connectionTimeoutMillis)
if (this.connectionTimeoutHandle.unref) {
this.connectionTimeoutHandle.unref()
}
}
if (this.host && this.host.indexOf('/') === 0) {