Skip to content

Commit

Permalink
lib: create weakRef only if any signals provided
Browse files Browse the repository at this point in the history
PR-URL: nodejs#48448
Fixes: nodejs#48419
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Nitzan Uziely <linkgoron@gmail.com>
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
  • Loading branch information
atlowChemi authored and Ceres6 committed Aug 14, 2023
1 parent b1f5d7b commit 30b380c
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/internal/abort_controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,9 @@ class AbortSignal extends EventTarget {
static any(signals) {
validateAbortSignalArray(signals, 'signals');
const resultSignal = createAbortSignal({ composite: true });
if (!signals.length) {
return resultSignal;
}
const resultSignalWeakRef = new WeakRef(resultSignal);
resultSignal[kSourceSignals] = new SafeSet();
for (let i = 0; i < signals.length; i++) {
Expand Down

0 comments on commit 30b380c

Please sign in to comment.