Skip to content

Switch to at-least-once delivery via score-based lease#5

Merged
lesnik512 merged 1 commit into
mainfrom
at-least-once-lease
May 3, 2026
Merged

Switch to at-least-once delivery via score-based lease#5
lesnik512 merged 1 commit into
mainfrom
at-least-once-lease

Conversation

@lesnik512
Copy link
Copy Markdown
Member

Replace the lock + ZREM-before-consume design with a Lua-based lease pattern: claim.lua atomically pushes the timer's score forward by lease_ttl and returns the payload; commit.lua removes the timer only after the handler ack/reject lands. This eliminates data loss on worker crash and removes the lock primitive entirely (4 RTTs -> 2). Default ack policy flipped to NACK_ON_ERROR so handler exceptions trigger retry via lease expiry. lock_ttl renamed to lease_ttl; lock_prefix removed. Handlers must now be idempotent.

Replace the lock + ZREM-before-consume design with a Lua-based lease
pattern: claim.lua atomically pushes the timer's score forward by
lease_ttl and returns the payload; commit.lua removes the timer only
after the handler ack/reject lands. This eliminates data loss on worker
crash and removes the lock primitive entirely (4 RTTs -> 2). Default
ack policy flipped to NACK_ON_ERROR so handler exceptions trigger retry
via lease expiry. lock_ttl renamed to lease_ttl; lock_prefix removed.
Handlers must now be idempotent.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@lesnik512 lesnik512 self-assigned this May 3, 2026
@lesnik512 lesnik512 merged commit 7746929 into main May 3, 2026
2 checks passed
@lesnik512 lesnik512 deleted the at-least-once-lease branch May 3, 2026 09:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant