From 571d1daf0847eb5e9b0f79fa80080831af9f911b Mon Sep 17 00:00:00 2001 From: Robert Nagy Date: Fri, 10 Mar 2023 07:52:22 +0100 Subject: [PATCH] fix: remove unnecessary WeakRef It's sufficient that the finalizer removes the closure. Fixes: https://github.com/nodejs/undici/issues/1926 --- lib/fetch/request.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/fetch/request.js b/lib/fetch/request.js index 9764871b6f6..c9672cddfaf 100644 --- a/lib/fetch/request.js +++ b/lib/fetch/request.js @@ -354,9 +354,8 @@ class Request { if (signal.aborted) { ac.abort(signal.reason) } else { - const acRef = new WeakRef(ac) const abort = function () { - acRef.deref()?.abort(this.reason) + ac.abort(this.reason) } if (getEventListeners(signal, 'abort').length >= defaultMaxListeners) {