fix: improve ping performance (#1020)
This commit is contained in:
@@ -15,7 +15,10 @@ export const pingJob = createCronJob("ping", EVERY_MINUTE, {
|
||||
}).withCallback(async () => {
|
||||
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);
|
||||
|
||||
if ("statusCode" in pingResult) {
|
||||
@@ -28,5 +31,4 @@ export const pingJob = createCronJob("ping", EVERY_MINUTE, {
|
||||
url,
|
||||
...pingResult,
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user