Skip to content

Commit e2b8446

Browse files
committed
fix rebalancing master queue shards after expiring a ttl run
1 parent 49b5d9f commit e2b8446

File tree

1 file changed

+9
-3
lines changed
  • internal-packages/run-engine/src/run-queue

1 file changed

+9
-3
lines changed

internal-packages/run-engine/src/run-queue/index.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1387,9 +1387,15 @@ export class RunQueue {
13871387
const keyPrefix = this.options.redis.keyPrefix ?? "";
13881388

13891389
for (const [masterQueueKey, queueNames] of queuesByMasterKey) {
1390-
// Deduplicate queue names within each master queue shard
1391-
const uniqueQueueNames = [...new Set(queueNames)];
1392-
pipeline.migrateLegacyMasterQueues(masterQueueKey, keyPrefix, ...uniqueQueueNames);
1390+
// For CK queues, skip the legacy rebalance — the CK index was already
1391+
// updated inside the Lua script, and migrateLegacyMasterQueues would
1392+
// re-add the concrete :ck:bar member to the master queue.
1393+
// Only rebalance non-CK queues here.
1394+
const nonCkQueues = queueNames.filter((q) => !q.includes(":ck:"));
1395+
if (nonCkQueues.length > 0) {
1396+
const uniqueQueueNames = [...new Set(nonCkQueues)];
1397+
pipeline.migrateLegacyMasterQueues(masterQueueKey, keyPrefix, ...uniqueQueueNames);
1398+
}
13931399
}
13941400

13951401
await pipeline.exec();

0 commit comments

Comments
 (0)