fix(parallel.js): add break statement to stop iterating over results if a promise is rejected
This commit is contained in:
parent
78ca03b004
commit
0aa73655b1
|
@ -13,6 +13,7 @@ const results = await Promise.allSettled(pingPromises);
|
||||||
for (let result of results) {
|
for (let result of results) {
|
||||||
if (result.status === 'rejected') {
|
if (result.status === 'rejected') {
|
||||||
console.error(result.reason);
|
console.error(result.reason);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log(result.value);
|
console.log(result.value);
|
||||||
|
|
Loading…
Reference in New Issue