[Bug]: Docs are incorrect for `deduplicated` queue event parameters
Version
v5.61.0
Platform
NodeJS
What happened?
See the docs for the deduplicated event:
/**
* Listen to 'deduplicated' event.
*
* This event is triggered when a job is not added to the queue because a job with the same deduplicationId
* already exists.
*
* @param args - An object containing details about the deduplicated job.
* - `jobId` - The unique identifier of the job that was attempted to be added.
* - `deduplicationId` - The deduplication identifier that caused the job to be deduplicated.
* - `deduplicatedJobId` - The unique identifier of the existing job that caused the deduplication.
* @param id - The identifier of the event.
*/
deduplicated: (
args: { jobId: string; deduplicationId: string; deduplicatedJobId: string },
id: string,
) => void;
It says that jobId refers to the "job that was attempted to be added" while deduplicatedJobId refers to "the existing job that caused the deduplication". But it's actually the other way around. In my testing, deduplicatedJobId always refers to the job that will be discarded due to the duplication.
Also, I think it would be better not to refer to the order of the jobs here, since the deduplication.replace job param can be used to cause a newer job to replace the older, existing one.
So I suggest these docs instead:
jobId- The unique identifier of the job that will be retained.deduplicatedJobId- The unique identifier of the job that will be discarded.
Also this description is not quite accurate
This event is triggered when a job is not added to the queue because a job with the same deduplicationId already exists.
It should probably be
This event is triggered when a job is not added to the queue because a job with the same deduplicationId 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.
How to reproduce.
No response
Relevant log output
Code of Conduct
- [x] I agree to follow this project's Code of Conduct
Thanks for reporting this issue.