Skip to content

Commit 838896a

Browse files
committed
fix(run-engine): restore the snapshotRoute read in the vtime TTL sweep
expireTtlRunsVtimeTracked is a copy of expireTtlRunsTracked, taken before main added the versioned residency resolver in 701374e. A copy does not pick up a change to its original, so the copy went on handing the TTL worker an item with no snapshotRoute while both non-vtime variants carried one. It did not read the message at all: no GET of messageKey, no snapshotRoute anywhere in it. Only reachable with the flag on, so nothing shipped. It is the second time this has happened on this branch, after the TTL re-registration, and it survived every review and both mutation audits, because a mutation audit tests whether something existing is covered and cannot see behaviour that was never carried across. The sweep is now its original plus two additions of its own, the state TTL argument and the ckVtime drain, with the read back in front of the delete.
1 parent a5fa891 commit 838896a

1 file changed

Lines changed: 12 additions & 1 deletion

File tree

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

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

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5201,6 +5201,17 @@ for i, member in ipairs(expiredMembers) do
52015201
52025202
local messageKey = keyPrefix .. "{org:" .. orgFromQueue .. "}:message:" .. runId
52035203
5204+
-- Read the message's versioned snapshotRoute BEFORE deleting it, so the TTL worker resolves each
5205+
-- run's residency from the route the birth stamped (no per-run durable lookup on the worker side).
5206+
local snapshotRoute = nil
5207+
local rawMessage = redis.call('GET', messageKey)
5208+
if rawMessage then
5209+
local ok, decoded = pcall(cjson.decode, rawMessage)
5210+
if ok and type(decoded) == 'table' and decoded.snapshotRoute ~= nil then
5211+
snapshotRoute = decoded.snapshotRoute
5212+
end
5213+
end
5214+
52045215
redis.call('DEL', messageKey)
52055216
52065217
-- ZREM from queue; if successful AND this is a CK variant, DECR lengthCounter.
@@ -5258,7 +5269,7 @@ for i, member in ipairs(expiredMembers) do
52585269
52595270
local serializedItem = cjson.encode({
52605271
job = "expireTtlRun",
5261-
item = { runId = runId, orgId = orgId, queueKey = rawQueueKey },
5272+
item = { runId = runId, orgId = orgId, queueKey = rawQueueKey, snapshotRoute = snapshotRoute },
52625273
visibilityTimeoutMs = visibilityTimeoutMs,
52635274
attempt = 0
52645275
})

0 commit comments

Comments
 (0)