|
15 | 15 | * 2. Checking which runs have QUEUED execution status (inconsistent state) |
16 | 16 | * 3. Re-adding them to their specific queue sorted sets |
17 | 17 | * 4. Removing them from the queue-specific currentConcurrency sets |
| 18 | + * 5. Removing them from the environment-level currentConcurrency set |
18 | 19 | * |
19 | 20 | * SAFETY: |
20 | 21 | * - Dry-run mode when no write Redis URL is provided (read-only, no writes) |
@@ -262,6 +263,7 @@ async function main() { |
262 | 263 | console.log(`This will:`); |
263 | 264 | console.log(` 1. Add each run back to its specific queue sorted set`); |
264 | 265 | console.log(` 2. Remove each run from the queue-specific currentConcurrency set`); |
| 266 | + console.log(` 3. Remove each run from the env-level currentConcurrency set`); |
265 | 267 | console.log(); |
266 | 268 |
|
267 | 269 | let successCount = 0; |
@@ -292,17 +294,27 @@ async function main() { |
292 | 294 | args: [run.runId], |
293 | 295 | description: `Remove run from queue currentConcurrency set`, |
294 | 296 | }, |
| 297 | + { |
| 298 | + type: "SREM", |
| 299 | + key: envConcurrencyKey, |
| 300 | + args: [run.runId], |
| 301 | + description: `Remove run from env currentConcurrency set`, |
| 302 | + }, |
295 | 303 | ]; |
296 | 304 |
|
297 | 305 | if (executeMode && redisWrite) { |
298 | 306 | // Execute operations using the write client |
299 | 307 | await redisWrite.zadd(queueKey, currentTimestamp, run.runId); |
300 | | - const removed = await redisWrite.srem(queueConcurrencyKey, run.runId); |
| 308 | + const removedFromQueue = await redisWrite.srem(queueConcurrencyKey, run.runId); |
| 309 | + const removedFromEnv = await redisWrite.srem(envConcurrencyKey, run.runId); |
301 | 310 |
|
302 | 311 | console.log(` ✓ Recovered run ${run.runId} (${run.taskIdentifier})`); |
303 | | - if (removed === 0) { |
| 312 | + if (removedFromQueue === 0) { |
304 | 313 | console.log(` ⚠ Run was not in queue currentConcurrency set`); |
305 | 314 | } |
| 315 | + if (removedFromEnv === 0) { |
| 316 | + console.log(` ⚠ Run was not in env currentConcurrency set`); |
| 317 | + } |
306 | 318 | successCount++; |
307 | 319 | } else { |
308 | 320 | // Dry run - just show what would be done |
|
0 commit comments