diff --git a/lib/internal/per_context/primordials.js b/lib/internal/per_context/primordials.js index c4f2b12aff2cba..5deea076755c9e 100644 --- a/lib/internal/per_context/primordials.js +++ b/lib/internal/per_context/primordials.js @@ -570,9 +570,17 @@ primordials.SafePromiseAllSettled = (promises, mapFn) => * @param {(v: T|PromiseLike, k: number) => U|PromiseLike} [mapFn] * @returns {Promise} */ -primordials.SafePromiseAllSettledReturnVoid = async (promises, mapFn) => { - await primordials.SafePromiseAllSettled(promises, mapFn); -}; +primordials.SafePromiseAllSettledReturnVoid = (promises, mapFn) => new Promise((resolve) => { + let pendingPromises = promises.length; + if (pendingPromises === 0) resolve(); + const onSettle = () => { + if (--pendingPromises === 0) resolve(); + }; + for (let i = 0; i < promises.length; i++) { + const promise = mapFn != null ? mapFn(promises[i], i) : promises[i]; + PromisePrototypeThen(PromiseResolve(promise), onSettle, onSettle); + } +}); /** * @template T,U