Skip to content

Commit f035bbc

Browse files
authored
fix(fetch): weaker refs (nodejs#1824)
1 parent 1b858fb commit f035bbc

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

lib/fetch/request.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,10 @@ class Request {
348348
if (signal.aborted) {
349349
ac.abort(signal.reason)
350350
} else {
351-
const abort = () => ac.abort(signal.reason)
351+
const acRef = new WeakRef(ac)
352+
const abort = function () {
353+
acRef.deref()?.abort(this.reason)
354+
}
352355
signal.addEventListener('abort', abort, { once: true })
353356
requestFinalizer.register(this, { signal, abort })
354357
}

0 commit comments

Comments
 (0)