Skip to content

Commit

Permalink
use promise.allSettled instead of all
Browse files Browse the repository at this point in the history
  • Loading branch information
lluisd committed Apr 2, 2024
1 parent d7576b8 commit b614280
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ async function updateClients() {
}
});

const pingResults = await Promise.all(ipsForClient.map(ip => pingIP(ip)));
const pingResults = await Promise.allSettled(ipsForClient.map(ip => pingIP(ip)));
ipsForClient = ipsForClient.filter((ip, index) => {
const isAlive = pingResults[index];
if (isAlive) {
Expand Down Expand Up @@ -95,7 +95,7 @@ async function updateClients() {
}
});

await Promise.all(clientUpdates);
await Promise.allSettled(clientUpdates);
} catch (error) {
console.error('Unable to update AdGuard clients', error.message);
}
Expand Down

0 comments on commit b614280

Please sign in to comment.