feat: extend volume backup functionality with scheduling and management

- Added support for volume backup jobs in the scheduling and removal processes.
- Enhanced job management to include volume backups in the job queue.
- Updated schema to accommodate volume backup data structure.
- Implemented initialization of volume backup jobs based on server status, improving backup management.
This commit is contained in:
Mauricio Siu
2025-07-02 00:45:57 -06:00
parent 6521491e2f
commit 107cdcee49
5 changed files with 84 additions and 4 deletions

View File

@@ -42,6 +42,12 @@ export const scheduleJob = (job: QueueJob) => {
pattern: job.cronSchedule,
},
});
} else if (job.type === "volume-backup") {
jobQueue.add(job.volumeBackupId, job, {
repeat: {
pattern: job.cronSchedule,
},
});
}
};
@@ -67,6 +73,13 @@ export const removeJob = async (data: QueueJob) => {
});
return result;
}
if (data.type === "volume-backup") {
const { volumeBackupId, cronSchedule } = data;
const result = await jobQueue.removeRepeatable(volumeBackupId, {
pattern: cronSchedule,
});
return result;
}
return false;
};
@@ -89,6 +102,10 @@ export const getJobRepeatable = async (
const job = repeatableJobs.find((j) => j.name === scheduleId);
return job ? job : null;
}
if (data.type === "volume-backup") {
const { volumeBackupId } = data;
const job = repeatableJobs.find((j) => j.name === volumeBackupId);
return job ? job : null;
}
return null;
};