( serverId: string, organizationId: string, enable: boolean, )
| 8 | import { removeJob, schedule } from "./backup"; |
| 9 | |
| 10 | export const applyDockerCleanupSchedule = async ( |
| 11 | serverId: string, |
| 12 | organizationId: string, |
| 13 | enable: boolean, |
| 14 | ) => { |
| 15 | if (enable) { |
| 16 | if (IS_CLOUD) { |
| 17 | await schedule({ |
| 18 | cronSchedule: CLEANUP_CRON_JOB, |
| 19 | serverId, |
| 20 | type: "server", |
| 21 | }); |
| 22 | } else { |
| 23 | scheduleJob(serverId, CLEANUP_CRON_JOB, async () => { |
| 24 | await cleanupAll(serverId); |
| 25 | await sendDockerCleanupNotifications(organizationId); |
| 26 | }); |
| 27 | } |
| 28 | } else { |
| 29 | if (IS_CLOUD) { |
| 30 | await removeJob({ |
| 31 | cronSchedule: CLEANUP_CRON_JOB, |
| 32 | serverId, |
| 33 | type: "server", |
| 34 | }); |
| 35 | } else { |
| 36 | scheduledJobs[serverId]?.cancel(); |
| 37 | } |
| 38 | } |
| 39 | }; |
no test coverage detected