From 0aa73655b1ea00a18fda053bed744b57a89eb1bf Mon Sep 17 00:00:00 2001 From: xzeldon Date: Sun, 22 Oct 2023 21:38:34 +0300 Subject: [PATCH] fix(parallel.js): add break statement to stop iterating over results if a promise is rejected --- example/parallel.js | 1 + 1 file changed, 1 insertion(+) diff --git a/example/parallel.js b/example/parallel.js index 5bedfda..9a1e641 100644 --- a/example/parallel.js +++ b/example/parallel.js @@ -13,6 +13,7 @@ const results = await Promise.allSettled(pingPromises); for (let result of results) { if (result.status === 'rejected') { console.error(result.reason); + break; } console.log(result.value);