fix(parallel.js): add break statement to stop iterating over results if a promise is rejected

This commit is contained in:
Timofey Gelazoniya 2023-10-22 21:38:34 +03:00
parent 78ca03b004
commit 0aa73655b1
Signed by: zeldon
GPG Key ID: 047886915281DD2A
1 changed files with 1 additions and 0 deletions

View File

@ -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);