Skip to content

Release unique locks after enqueue failures#72

Merged
mgomes merged 6 commits into
masterfrom
fix/unique-lock-enqueue-failure
Jun 5, 2026
Merged

Release unique locks after enqueue failures#72
mgomes merged 6 commits into
masterfrom
fix/unique-lock-enqueue-failure

Conversation

@mgomes
Copy link
Copy Markdown
Owner

@mgomes mgomes commented Jun 5, 2026

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.

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread client/client.go Outdated
@mgomes
Copy link
Copy Markdown
Owner Author

mgomes commented Jun 5, 2026

@codex review

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread client/client.go Outdated
@mgomes
Copy link
Copy Markdown
Owner Author

mgomes commented Jun 5, 2026

@codex review

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment on lines +35 to +36
redis.call('SADD', KEYS[2], ARGV[3])
redis.call('LPUSH', KEYS[3], ARGV[4])
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

@mgomes
Copy link
Copy Markdown
Owner Author

mgomes commented Jun 5, 2026

@codex review

@chatgpt-codex-connector
Copy link
Copy Markdown

Codex Review: Didn't find any major issues. You're on a roll.

ℹ️ 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".

@mgomes
Copy link
Copy Markdown
Owner Author

mgomes commented Jun 5, 2026

@codex review

@chatgpt-codex-connector
Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 👍

ℹ️ 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".

@mgomes mgomes merged commit fc073ea into master Jun 5, 2026
7 checks passed
@mgomes mgomes deleted the fix/unique-lock-enqueue-failure branch June 5, 2026 02:15
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