Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Call fg.unregister() after a dispatcher is done, adds UNDICI_NO_FG to… #2527

Merged
merged 3 commits into from
Dec 20, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions lib/agent.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ class Agent extends DispatcherBase {
const client = ref.deref()
/* istanbul ignore else: gc is undeterministic */
if (client) {
this[kFinalizer].unregister(client)
closePromises.push(client.close())
}
}
Expand All @@ -137,6 +138,7 @@ class Agent extends DispatcherBase {
const client = ref.deref()
/* istanbul ignore else: gc is undeterministic */
if (client) {
this[kFinalizer].unregister(client)
destroyPromises.push(client.destroy(err))
}
}
Expand Down
2 changes: 1 addition & 1 deletion lib/core/connect.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ let tls // include tls conditionally since it is not always available
let SessionCache
// FIXME: remove workaround when the Node bug is fixed
// https://github.com/nodejs/node/issues/49344#issuecomment-1741776308
if (global.FinalizationRegistry && !process.env.NODE_V8_COVERAGE) {
if (global.FinalizationRegistry && !(process.env.NODE_V8_COVERAGE || process.env.UNDICI_NO_FG)) {
SessionCache = class WeakSessionCache {
constructor (maxCachedSessions) {
this._maxCachedSessions = maxCachedSessions
Expand Down