fix(volume-backups): cancel the scheduled job when a volume backup is deleted - #5454
Dev-next-gen wants to merge 2 commits into
Conversation
… deleted The delete procedure only removed the database row. The node-schedule job (self-hosted) or the BullMQ repeatable job (cloud) registered at creation kept firing on its cron and failed each time with "Volume backup not found". Cancel it the same way backup.remove and schedule.delete already do.
|
1. 2. 3. |
Cancellation now runs before removeVolumeBackup, so a cancellation that fails leaves the record in place and the mutation can be retried instead of committing the deletion and leaving an orphan job behind. The local branch awaits removeVolumeBackupJob, delete skips cancellation for a backup that was never enabled, and the IS_CLOUD branch shared by delete and update moves into a cancelVolumeBackupJob helper.
|
All four are right, and the second one I had missed: Pushed as a148c0c. Cancellation now runs before The one judgement call I would rather hand back to you is that Found by a defect-hunting pipeline I build and run (Dev-next-gen), using Claude Code with Anthropic's Claude Opus 5. |
What is this PR about?
While comparing how the different routers tear down their cron jobs, I noticed that
volumeBackups.deleteonly callsremoveVolumeBackup, which deletes the database row and nothing else.backup.removeandschedule.deletealso cancel the job they registered, but the volume backup path never does: the node-schedule job (self-hosted) or the BullMQ repeatable job (cloud) created involumeBackups.createkeeps firing on its cron and each run fails infindVolumeBackupByIdwith "Volume backup not found", until the process or the jobs service restarts.The fix cancels the job right after the row is deleted, the same way
schedule.deletedoes:removeJobwith the stored cron expression in cloud,removeVolumeBackupJobotherwise.I added
__test__/backups/volume-backup-delete.test.ts, which calls the router throughcreateCallerwith the server functions mocked. Oncanaryboth cases fail (removeVolumeBackupJobandremoveJobare called 0 times); with the change they pass.pnpm run typecheckinapps/dokployis clean, and the full vitest suite passes exceptdeploy/application.real.test.ts, which needs nixpacks and real Docker builds on the machine and is unrelated to this change.Checklist
Before submitting this PR, please make sure that:
canarybranch.To be upfront about that last box: I verified the change with the unit test above and the typecheck, not by deleting a volume backup in a running Dokploy instance.
Issues related (if applicable)
None that I could find.
Screenshots (if applicable)
AI tools used
The PR appears safe to merge, with no outstanding findings or new changes since the previous review.
Summary
Fixes volume-backup deletion so its scheduled work is also canceled after the database record is removed.
Reviews (2) · Last reviewed commit: "fix(volume-backups): cancel the schedule..."