Skip to content

Commit 7f01aaf

Browse files
committed
fix(run-engine): re-register the TTL entry when the vtime dequeue expires a run
The vtime dequeue is a copy of dequeueMessagesFromCkQueueTracked, and main added a TTL re-registration to that command while this branch was open. A copy cannot pick up a change to its original, so the rebase left the vtime path behind: it drops an expired run from the queue sorted sets and defers to a TTL consumer that has no entry for it, because the entry is removed on first dequeue. The run is then orphaned. Only reachable with the flag on, so nothing shipped, but it would have gone out with the feature. Same four lines as the base command, verbatim; the expired branch is now identical between the two again. Copies drifting like this is a known cost of the vtime scripts being copies, kept deliberately so the flag-off path stays byte-identical to production. The drift is worth a test that pins each copy against its original, which would have caught this the day main merged.
1 parent 188a443 commit 7f01aaf

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

  • internal-packages/run-engine/src/run-queue

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5526,6 +5526,10 @@ local function tryServe(ckQueueName, mayRaiseFloor, knownRegistered)
55265526
redis.call('ZREM', fullQueueKey, messageId)
55275527
redis.call('ZREM', envQueueKey, messageId)
55285528
decrLengthCounter()
5529+
if ttlQueueKey and ttlQueueKey ~= '' then
5530+
local ttlMember = ckQueueName .. '|' .. messageId .. '|' .. (messageData.orgId or '')
5531+
redis.call('ZADD', ttlQueueKey, ttlExpiresAt, ttlMember)
5532+
end
55295533
else
55305534
redis.call('ZREM', fullQueueKey, messageId)
55315535
redis.call('ZREM', envQueueKey, messageId)

0 commit comments

Comments
 (0)