Release unique locks after enqueue failures#72
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6135eb9132
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6312dabe10
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 476a59fc25
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| redis.call('SADD', KEYS[2], ARGV[3]) | ||
| redis.call('LPUSH', KEYS[3], ARGV[4]) |
There was a problem hiding this comment.
Clear the unique lock on post-claim write errors
When Redis raises an error after the SET succeeds (for example under maxmemory/OOM during SADD or LPUSH), Lua script execution stops but the earlier SET is not rolled back. In that scenario Enqueue returns an error while the unique key remains claimed until its TTL, so immediate retries are rejected as duplicates even though the job was never queued; the same post-claim pattern exists in the scheduled script's ZADD path. Consider wrapping the downstream writes with redis.pcall and deleting KEYS[1] before returning the error.
Useful? React with 👍 / 👎.
|
@codex review |
|
Codex Review: Didn't find any major issues. You're on a roll. ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
@codex review |
|
Codex Review: Didn't find any major issues. 👍 ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Why
Unique jobs should only reserve their uniqueness key once the job is durably visible to workers.
If Redis accepts the unique lock but a later enqueue step fails, leaving that lock behind blocks valid future work until the TTL expires. Releasing only the matching job lock keeps uniqueness guarantees without turning transient enqueue failures into long-lived suppression.