bullmq icon indicating copy to clipboard operation
bullmq copied to clipboard

[Bug]: Duplicate Jobs Created Despite Same Custom Key with Different Repeat Intervals

Open erenkurnaz opened this issue 1 year ago • 0 comments

Version

v5.1.5

Platform

NodeJS

What happened?

Description: I've encountered an issue related to creating repeated jobs with a custom key using the BullMQ package. This functionality was introduced in PR #1824.

Issue: When I add a job with the same repeat interval and custom key, no duplicate jobs are created, which is the expected behavior:

await queue.add(queueName, {}, {
  repeat: {
    every: 1 * 1000,
    key: 'custom-key'
  },
});

However, changing the repeat interval while keeping the same key results in the creation of duplicate jobs:

await queue.add(queueName, {}, {
  repeat: {
    every: 2 * 1000,
    key: 'custom-key'
  },
});

Expected Behavior: Even when the repeat interval is modified, as long as the custom key remains the same, it should not result in duplicate jobs. The uniqueness of a job should be maintained based on the custom key provided.

How to reproduce.

Steps to Reproduce:

  • Create a repeated job with a specific interval and a custom key.
  • Create another job with a different interval but the same custom key.
  • Observe that duplicate jobs are created.

Relevant log output

No response

Code of Conduct

  • [X] I agree to follow this project's Code of Conduct

erenkurnaz avatar Jan 26 '24 13:01 erenkurnaz