mirror of
https://github.com/andwati/dokploy.git
synced 2026-11-13 07:25:17 +00:00
fix(schedules): ensure cronSchedule is always a string when removing jobs
- Updated the job removal logic to default cronSchedule to an empty string if job.pattern is undefined, preventing potential errors during job removal.
This commit is contained in:
@@ -47,25 +47,25 @@ app.post("/update-backup", zValidator("json", jobQueueSchema), async (c) => {
|
||||
result = await removeJob({
|
||||
backupId: data.backupId,
|
||||
type: "backup",
|
||||
cronSchedule: job.pattern,
|
||||
cronSchedule: job.pattern || "",
|
||||
});
|
||||
} else if (data.type === "server") {
|
||||
result = await removeJob({
|
||||
serverId: data.serverId,
|
||||
type: "server",
|
||||
cronSchedule: job.pattern,
|
||||
cronSchedule: job.pattern || "",
|
||||
});
|
||||
} else if (data.type === "schedule") {
|
||||
result = await removeJob({
|
||||
scheduleId: data.scheduleId,
|
||||
type: "schedule",
|
||||
cronSchedule: job.pattern,
|
||||
cronSchedule: job.pattern || "",
|
||||
});
|
||||
} else if (data.type === "volume-backup") {
|
||||
result = await removeJob({
|
||||
volumeBackupId: data.volumeBackupId,
|
||||
type: "volume-backup",
|
||||
cronSchedule: job.pattern,
|
||||
cronSchedule: job.pattern || "",
|
||||
});
|
||||
}
|
||||
logger.info({ result }, "Job removed");
|
||||
|
||||
Reference in New Issue
Block a user