feat(settings): add simple-ping settings (#2118)

This commit is contained in:
Meier Lukas authored and GitHub committed 2025-02-07 22:10:35 +01:00
1 parent c04c42dc8a
commit dff6cb9d31
88 files changed
+4489 -582

No files matched your search

+9
View File
@@ -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));