-
Notifications
You must be signed in to change notification settings - Fork 518
docs: fix deduplicated event parameter descriptions #3525
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
The documentation incorrectly stated that jobId refers to the job that was attempted to be added and deduplicatedJobId refers to the existing job. The actual behavior is the opposite: - jobId: The job that will be retained - deduplicatedJobId: The job that will be discarded Also updated the event description to clarify it fires both when a job is not added due to an existing duplicate and when an existing job is replaced by a new one (when using the replace option).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR updates the documentation for the deduplicated event to clarify the semantics of jobId and deduplicatedJobId parameters. The changes address ambiguity in the event's documentation by explicitly stating that this event fires both when a new job is rejected due to an existing duplicate and when an existing job is replaced by a new one.
- Updated the event description to include both deduplication scenarios (rejection and replacement)
- Clarified parameter meanings:
jobIdrefers to the retained job,deduplicatedJobIdrefers to the discarded job - Updated example code and parameter descriptions in both code comments and documentation to reflect these clarifications
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/classes/queue-events.ts | Updated JSDoc comments for the deduplicated event to clarify the dual nature of the event and the semantics of jobId vs deduplicatedJobId parameters |
| docs/gitbook/guide/jobs/deduplication.md | Updated documentation examples and parameter descriptions to match the clarified event semantics |
Comments suppressed due to low confidence (1)
docs/gitbook/guide/jobs/deduplication.md:86
- The description of the
deduplicatedevent states it's emitted when a job is 'ignored', but based on the updated JSDoc comments (lines 89-90), the event is also triggered when an existing job is discarded/replaced. This section should be updated to mention both scenarios: when a new job is ignored AND when an existing job is replaced, to match the updated technical documentation.
The **deduplicated** event is emitted whenever a job is ignored due to deduplication in either Simple Mode or Throttle Mode. This event allows you to monitor deduplication activity and take action if needed, such as logging the occurrence or notifying a user that their request was ignored.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
Comments suppressed due to low confidence (1)
docs/gitbook/guide/jobs/deduplication.md:86
- This statement says the deduplicated event is only emitted in Simple Mode or Throttle Mode. However, the updated documentation in the TypeScript file (lines 89-90) and the examples below (lines 108-110) indicate the event is also emitted in Debounce Mode when
replace: true. This section should be updated to mention that the event is also emitted when an existing job is replaced in Debounce Mode with the replace option.
The **deduplicated** event is emitted whenever a job is ignored due to deduplication in either Simple Mode or Throttle Mode. This event allows you to monitor deduplication activity and take action if needed, such as logging the occurrence or notifying a user that their request was ignored.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| * This event is triggered when a job is not added to the queue because a job with the same deduplicationId | ||
| * already exists. | ||
| * already exists. It is also triggered when an existing job is discarded from the queue because a new job | ||
| * with the same deduplicationId is about to replace it. |
Copilot
AI
Nov 3, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The updated documentation describes that this event is triggered for both Simple/Throttle Mode (job rejection) and Debounce Mode with replace (job replacement). However, based on the Lua implementation in deduplicateJob.lua, the jobId and deduplicatedJobId parameters have opposite meanings in these two scenarios. In replace mode (line 17-18 of deduplicateJob.lua), jobId is the new job being added and deduplicatedJobId is the old job being removed. In normal dedup mode (lines 96-97), jobId is the existing job and deduplicatedJobId is the new job being rejected. The documentation at lines 93 and 95 states that jobId is 'the job that will be retained' and deduplicatedJobId is 'the job that will be discarded', which is only accurate for the replace scenario. This inconsistency should be documented or the implementation should be made consistent.
The documentation for the
deduplicatedevent incorrectly stated thatjobIdrefers to the attempted job anddeduplicatedJobIdrefers to the existing job. The actual behavior is reversed.Changes
TypeScript API docs (
src/classes/queue-events.ts): Corrected parameter descriptionsjobId:job that was attempted to be added→ job that will be retaineddeduplicatedJobId:existing job that caused deduplication→ job that will be discardedreplaceoption)User guide (
docs/gitbook/guide/jobs/deduplication.md): Updated example and parameter list to match corrected behaviorExample
Verified against Lua implementation in
src/commands/includes/deduplicateJob.luawhere the parameters are emitted.Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
badhost/usr/local/bin/node --trace-warnings /home/REDACTED/work/bullmq/bullmq/node_modules/mocha/lib/cli/cli.js tests/test_deduplication.ts ./tests/test_*.ts --require /home/REDACTED/work/bullmq/bullmq/node_modules/ts-mocha/src/index.js --no-config --no-package --exit --file ./mocha.setup.ts --timeout 4000 --diff --extension js --extension cjs --extension mjs --reporter spec --slow 75 --ui bdd --watch-ignore node_modules --watch-ignore .git(dns block)If you need me to access, download, or install something from one of these locations, you can either:
Original prompt
deduplicatedqueue event parameters #3523💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.