fix: Backup schedules and pruning
All checks were successful
Deploy to Staging / Build Images (push) Successful in 4m30s
Deploy to Staging / Deploy to Staging (push) Successful in 37s
Deploy to Staging / Verify Staging (push) Successful in 6s
Deploy to Staging / Notify Staging Ready (push) Successful in 5s
Deploy to Staging / Notify Staging Failure (push) Has been skipped

This commit is contained in:
Eric Gullickson
2026-01-01 11:40:49 -06:00
parent d8ea0c7297
commit 7f278f6574
7 changed files with 7 additions and 7 deletions

View File

@@ -13,13 +13,13 @@ The `DistributedLockService` in `redis.ts` provides Redis-based distributed lock
**All scheduled jobs MUST use distributed locking** to prevent duplicate execution when multiple backend containers are running.
```typescript
import { randomUUID } from 'crypto';
import { lockService } from '../core/config/redis';
import { v4 as uuidv4 } from 'uuid';
// Acquire lock (returns false if already held)
const lockKey = 'job:my-scheduled-task';
const lockValue = uuidv4(); // Unique identifier for this execution
const ttlSeconds = 300; // Auto-release after 5 minutes
const lockValue = randomUUID(); // Unique identifier for this execution
const ttlSeconds = 300; // Auto-release after 5 minutes
const acquired = await lockService.acquireLock(lockKey, ttlSeconds, lockValue);
if (!acquired) {

View File

@@ -22,13 +22,13 @@ The scheduler runs periodic background jobs. In blue-green deployments, **multip
### Pattern for New Jobs
```typescript
import { v4 as uuidv4 } from 'uuid';
import { randomUUID } from 'crypto';
import { lockService } from '../../core/config/redis';
import { logger } from '../../core/logging/logger';
export async function processMyJob(): Promise<void> {
const lockKey = 'job:my-job-name';
const lockValue = uuidv4();
const lockValue = randomUUID();
const lockTtlSeconds = 300; // 5 minutes - adjust based on expected job duration
// Try to acquire lock

View File

@@ -5,7 +5,7 @@
*/
import { Pool } from 'pg';
import { v4 as uuidv4 } from 'uuid';
import { randomUUID } from 'crypto';
import { logger } from '../../../core/logging/logger';
import { lockService } from '../../../core/config/redis';
import { BackupRepository } from '../data/backup.repository';
@@ -59,7 +59,7 @@ export async function processScheduledBackups(): Promise<ScheduledBackupJobResul
for (const schedule of dueSchedules) {
// Generate unique lock value for this execution
const lockKey = `backup:schedule:${schedule.id}`;
const lockValue = uuidv4();
const lockValue = randomUUID();
// Try to acquire lock for this schedule
const lockAcquired = await lockService.acquireLock(lockKey, BACKUP_LOCK_TTL_SECONDS, lockValue);

Binary file not shown.

Before

Width:  |  Height:  |  Size: 96 KiB

After

Width:  |  Height:  |  Size: 96 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 180 KiB

After

Width:  |  Height:  |  Size: 180 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 255 KiB

After

Width:  |  Height:  |  Size: 255 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 67 KiB

After

Width:  |  Height:  |  Size: 67 KiB