mirror of
https://github.com/Dokploy/dokploy.git
synced 2026-06-28 18:45:22 +02:00
fix: remove cron jobs after delete service
This commit is contained in:
@@ -1,3 +1,10 @@
|
||||
import {
|
||||
type BackupScheduleList,
|
||||
IS_CLOUD,
|
||||
removeScheduleBackup,
|
||||
scheduleBackup,
|
||||
} from "@dokploy/server/index";
|
||||
|
||||
type QueueJob =
|
||||
| {
|
||||
type: "backup";
|
||||
@@ -59,3 +66,19 @@ export const updateJob = async (job: QueueJob) => {
|
||||
throw error;
|
||||
}
|
||||
};
|
||||
|
||||
export const cancelJobs = async (backups: BackupScheduleList) => {
|
||||
for (const backup of backups) {
|
||||
if (backup.enabled) {
|
||||
if (IS_CLOUD) {
|
||||
await removeJob({
|
||||
cronSchedule: backup.schedule,
|
||||
backupId: backup.backupId,
|
||||
type: "backup",
|
||||
});
|
||||
} else {
|
||||
removeScheduleBackup(backup.backupId);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user