diff --git a/server/src/service/infrastructure/SuperSimpleQueue/SuperSimpleQueueHelper.ts b/server/src/service/infrastructure/SuperSimpleQueue/SuperSimpleQueueHelper.ts index eca380537..382318945 100644 --- a/server/src/service/infrastructure/SuperSimpleQueue/SuperSimpleQueueHelper.ts +++ b/server/src/service/infrastructure/SuperSimpleQueue/SuperSimpleQueueHelper.ts @@ -390,6 +390,15 @@ export class SuperSimpleQueueHelper implements ISuperSimpleQueueHelper { const settings = await this.settingsService.getDBSettings(); const checkTTL = settings.checkTTL; // Check TTL is in DAYS, not MS + + if (checkTTL === 366) { + this.logger.info({ + message: `Check TTL is set to unlimited, skipping cleanup`, + service: SERVICE_NAME, + method: "getCleanupRetentionJob", + }); + return; + } const checkTTLInMs = checkTTL * 24 * 60 * 60 * 1000; const cutoffDate = new Date(Date.now() - checkTTLInMs); const deleteCount = await this.checkService.deleteOlderThan(cutoffDate); diff --git a/server/src/validation/settingsValidation.ts b/server/src/validation/settingsValidation.ts index ee2a2ee87..0aeec943f 100644 --- a/server/src/validation/settingsValidation.ts +++ b/server/src/validation/settingsValidation.ts @@ -6,7 +6,7 @@ import { z } from "zod"; export const updateAppSettingsBodyValidation = z .object({ - checkTTL: z.union([z.number(), z.literal("")]).optional(), + checkTTL: z.union([z.number().int().min(1).max(366), z.literal("")]).optional(), systemEmailPort: z.union([z.number(), z.literal("")]).optional(), pagespeedApiKey: z.union([z.string(), z.literal("")]).optional(),