fix: Implement distribute locker in Redis for cron jobs
Some checks failed
Deploy to Staging / Build Images (push) Failing after 30s
Deploy to Staging / Deploy to Staging (push) Has been skipped
Deploy to Staging / Verify Staging (push) Has been skipped
Deploy to Staging / Notify Staging Ready (push) Has been skipped
Deploy to Staging / Notify Staging Failure (push) Successful in 6s
Some checks failed
Deploy to Staging / Build Images (push) Failing after 30s
Deploy to Staging / Deploy to Staging (push) Has been skipped
Deploy to Staging / Verify Staging (push) Has been skipped
Deploy to Staging / Notify Staging Ready (push) Has been skipped
Deploy to Staging / Notify Staging Failure (push) Successful in 6s
This commit is contained in:
@@ -111,7 +111,23 @@ Backups are stored in `/app/data/backups/` (mapped to `./data/backups/` on host)
|
||||
|
||||
Jobs are registered in `backend/src/core/scheduler/index.ts`:
|
||||
- Backup check: Every minute
|
||||
- Retention cleanup: Daily at 4 AM
|
||||
- Retention cleanup: Daily at 4 AM (also runs after each scheduled backup)
|
||||
|
||||
### Distributed Locking
|
||||
|
||||
Scheduled backups use Redis distributed locking to prevent duplicate backups when multiple backend containers are running (blue-green deployments).
|
||||
|
||||
**Lock behavior:**
|
||||
- Lock key: `backup:schedule:{schedule_id}`
|
||||
- Lock TTL: 5 minutes (auto-release if container crashes)
|
||||
- Only one container creates the backup; others skip
|
||||
|
||||
**Retention cleanup:**
|
||||
- Runs immediately after each successful scheduled backup
|
||||
- Deletes backups exceeding the schedule's retention count
|
||||
- Also runs globally at 4 AM daily as a safety net
|
||||
|
||||
See `backend/src/core/scheduler/README.md` for the distributed locking pattern.
|
||||
|
||||
### Admin Routes
|
||||
|
||||
|
||||
Reference in New Issue
Block a user