Skip to content

Commit 4c7df92

Browse files
committed
fix(execution): heal a user budget key that somehow has no expiry
The no-op branch of the flush script dropped the user-key EXPIRE outright rather than guarding it like every other site. No current path can create the key without an expiry, but if one ever did, that branch was the one place that would never give it one — and a user counter with no expiry is the unbounded version of the bug this series fixes. Guard it instead, so the branch heals such a key rather than skipping it, and so all five scripts read the same way.
1 parent 22f03db commit 4c7df92

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

apps/sim/lib/execution/event-buffer.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,9 @@ else
109109
if redis.call('EXISTS', KEYS[4]) == 1 then
110110
redis.call('EXPIRE', KEYS[4], budget_ttl_seconds)
111111
end
112+
if #KEYS >= 5 and redis.call('EXISTS', KEYS[5]) == 1 and redis.call('TTL', KEYS[5]) < 0 then
113+
redis.call('EXPIRE', KEYS[5], budget_ttl_seconds)
114+
end
112115
end
113116
for i = 9, #ARGV, 2 do
114117
redis.call('ZADD', KEYS[1], ARGV[i], ARGV[i + 1])

0 commit comments

Comments
 (0)