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

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

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));