fix: improve ping performance (#1020)

This commit is contained in:
Meier Lukas
2024-08-24 16:56:40 +02:00
committed by GitHub
parent acbb834889
commit b81f5a2ee3

View File

@@ -15,7 +15,10 @@ export const pingJob = createCronJob("ping", EVERY_MINUTE, {
}).withCallback(async () => { }).withCallback(async () => {
const urls = await pingUrlChannel.getAllAsync(); const urls = await pingUrlChannel.getAllAsync();
for (const url of new Set(urls)) { await Promise.allSettled([...new Set(urls)].map(pingAsync));
});
const pingAsync = async (url: string) => {
const pingResult = await sendPingRequestAsync(url); const pingResult = await sendPingRequestAsync(url);
if ("statusCode" in pingResult) { if ("statusCode" in pingResult) {
@@ -28,5 +31,4 @@ export const pingJob = createCronJob("ping", EVERY_MINUTE, {
url, url,
...pingResult, ...pingResult,
}); });
} };
});