fix: improve ping performance (#1020)
This commit is contained in:
@@ -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,
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
});
|
|
||||||
|
|||||||
Reference in New Issue
Block a user