Skip to content

Conversation

@Darkemon
Copy link
Collaborator

No description provided.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Updates documentation and tests to reflect/verify the intended semantics of “unique” jobs (including while running and during retries), plus a small test-infra Makefile update.

Changes:

  • Clarify unique-job semantics in enqueue.go docstrings and README.md.
  • Add tests ensuring unique locks prevent duplicate enqueues while a job is actively processing (keyed and non-keyed).
  • Switch test infra commands from docker-compose to docker compose in the Makefile.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.

File Description
enqueue_test.go Expands unique-job test commentary and adds new tests asserting the uniqueness lock is held during active processing.
enqueue.go Updates public API comments for EnqueueUnique* to describe uniqueness behavior across queue/processing/retry/dead.
README.md Adds/extends documentation describing when the unique Redis key is held and cleared.
Makefile Updates test setup/teardown to use Docker Compose v2 CLI (docker compose).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +120 to +124
// While a job is enqueued, being processed, or present in the retry queue, the unique lock is held
// and another job with the same name and key cannot be enqueued. The unique key is removed only after
// the job finishes (or is moved to the dead queue), at which point a new unique job may be enqueued.
// In order to add robustness to the system, jobs are only unique for 24 hours after they're enqueued —
// this is mostly relevant for scheduled jobs.
Copy link

Copilot AI Jan 22, 2026

Choose a reason for hiding this comment

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

Same documentation issue as EnqueueUnique: the unique key has a 24h TTL in the Lua script (redis.go:381) and can expire before the job completes/reaches dead, so the lock is not guaranteed to persist for the full lifecycle. Please reflect this TTL/expiry behavior in this doc comment (or change the implementation to refresh TTL as needed).

Copilot uses AI. Check for mistakes.
Comment on lines +103 to +107
// While a job is enqueued, being processed, or present in the retry queue, the unique lock is held
// and another job with the same name and arguments cannot be enqueued. The unique key is removed
// only after the job finishes (or is moved to the dead queue), at which point a new unique job may
// be enqueued. In order to add robustness to the system, jobs are only unique for 24 hours after
// they're enqueued — this is mostly relevant for scheduled jobs.
Copy link

Copilot AI Jan 22, 2026

Choose a reason for hiding this comment

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

The comment says the unique key is removed only after the job finishes or is moved to the dead queue, but the Redis unique key is also set with a 24h TTL (see redis.go:366) and is not refreshed during processing/retries. That means the lock can expire before completion for long-running or long-delayed jobs. Please clarify the docstring to mention the TTL/possible expiry (or adjust the implementation to refresh the TTL while the job exists).

Copilot uses AI. Check for mistakes.
Darkemon and others added 2 commits January 22, 2026 16:35
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@Darkemon Darkemon merged commit 2a1d1e4 into master Jan 22, 2026
2 of 4 checks passed
@Darkemon Darkemon deleted the unique-jobs-update-tests branch January 22, 2026 13:39
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.

3 participants