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
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:
@@ -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) {
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user