feat(settings): add simple-ping settings (#2118)
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
import { EVERY_MINUTE } from "@homarr/cron-jobs-core/expressions";
|
||||
import { db } from "@homarr/db";
|
||||
import { getServerSettingByKeyAsync } from "@homarr/db/queries";
|
||||
import { logger } from "@homarr/log";
|
||||
import { sendPingRequestAsync } from "@homarr/ping";
|
||||
import { pingChannel, pingUrlChannel } from "@homarr/redis";
|
||||
@@ -13,6 +15,13 @@ const resetPreviousUrlsAsync = async () => {
|
||||
export const pingJob = createCronJob("ping", EVERY_MINUTE, {
|
||||
beforeStart: resetPreviousUrlsAsync,
|
||||
}).withCallback(async () => {
|
||||
const boardSettings = await getServerSettingByKeyAsync(db, "board");
|
||||
|
||||
if (boardSettings.forceDisableStatus) {
|
||||
logger.debug("Simple ping is disabled by server settings");
|
||||
return;
|
||||
}
|
||||
|
||||
const urls = await pingUrlChannel.getAllAsync();
|
||||
|
||||
await Promise.allSettled([...new Set(urls)].map(pingAsync));
|
||||
|
||||
Reference in New Issue
Block a user