feat(schedules): replace hardcoded cron schedule with CLEANUP_CRON_JOB constant

- Updated the cron schedule for Docker cleanup tasks across multiple files to use the new CLEANUP_CRON_JOB constant.
- This change enhances maintainability by centralizing the cron schedule configuration, ensuring consistency across the application.
This commit is contained in:
Mauricio Siu
2026-02-07 22:58:21 -06:00
parent b9e700243e
commit 110bdce38c
4 changed files with 12 additions and 7 deletions

View File

@@ -1,4 +1,5 @@
import {
CLEANUP_CRON_JOB,
canAccessToTraefikFiles,
checkGPUStatus,
checkPortInUse,
@@ -298,12 +299,12 @@ export const settingsRouter = createTRPCRouter({
}
if (IS_CLOUD) {
await schedule({
cronSchedule: "0 0 * * *",
cronSchedule: CLEANUP_CRON_JOB,
serverId: input.serverId,
type: "server",
});
} else {
scheduleJob(server.serverId, "0 0 * * *", async () => {
scheduleJob(server.serverId, CLEANUP_CRON_JOB, async () => {
console.log(
`Docker Cleanup ${new Date().toLocaleString()}] Running...`,
);
@@ -316,7 +317,7 @@ export const settingsRouter = createTRPCRouter({
} else {
if (IS_CLOUD) {
await removeJob({
cronSchedule: "0 0 * * *",
cronSchedule: CLEANUP_CRON_JOB,
serverId: input.serverId,
type: "server",
});
@@ -331,7 +332,7 @@ export const settingsRouter = createTRPCRouter({
});
if (settingsUpdated?.enableDockerCleanup) {
scheduleJob("docker-cleanup", "0 0 * * *", async () => {
scheduleJob("docker-cleanup", CLEANUP_CRON_JOB, async () => {
console.log(
`Docker Cleanup ${new Date().toLocaleString()}] Running...`,
);