bullmq
bullmq copied to clipboard
[Bug]: Removing repeatable job, does not remove current delayed job
Version
4.9.0
Platform
NodeJS
What happened?
I created a repeatable job by using the following method.
await myQueue.add(`${some_random_id}`,
{...data},
{ repeatJobKey: `${some_random_id}`, repeat: { every: 3480000 } });
I remove the repeatable job using method
const job = await myQueue.removeRepeatableByKey(
that_random_id
);
It successfully deletes from the repeatable job list. which I attain from the method getRepeatableJobs(),
However not from bull-ui.
The current delayed job is kept in the platform, only after its execution I see no further jobs being spawned.
This seems to be happening post-version 4.7.0, I was not able to backtrack breaking version.
How to reproduce.
Platform
OS: Ubuntu 22.04.3 LTS Node.js : v18.17.1 Redis: 7.2.0
The Code To add to queue
await myQueue.add(`${some_random_id}`,
{...data},
{ repeatJobKey: `${some_random_id}`, repeat: { every: 3480000 } });
The code to remove to queue
console.log("before ----------------->", (await myQueue.getRepeatableJobs()).length)
const removed = await myQueue.removeRepeatableByKey(
that_id
);
console.log("remove ------>", removed);
console.log("after ----------------->", (await myQueue.getRepeatableJobs()).length)
Output on stdout for removal
Bull UI
Relevant log output
No response
Code of Conduct
- [X] I agree to follow this project's Code of Conduct
what does myQueue.getDelayed() return after removing the repeatable job?
hi @i-rebel-aj, repeatJobKey is not supposed to be set by users, this is generated by bullmq and it's considered as an internal property https://api.docs.bullmq.io/interfaces/v4.BaseJobOptions.html#repeatJobKey
I had the same problem, when I deleted the repeatable task, it returned to normal, but the most recent one still got executed and I could see the task on the UI panel
It will not be actually removed until the latest repeatable task is executed.
bull version 4.10.4
what does
myQueue.getDelayed()return after removing the repeatable job?
Using getDelayed still returns the most recent repeatable task. I need to manually remove the task before I can actually remove the repeatable task.
Experiencing the same behaviour
@manast , @roggervalf, this is still happening with v5.8.3.
I also tried applying the patch from https://github.com/taskforcesh/bullmq/pull/2617, but the issue is still there.
What are the next steps to resolve this? Do you guys need a minimal reproducible example here?
hi @dalechyn, if you can provide a minimal test case where we can reproduce it, we have some tests that cover removal of delayed jobs from repeatables https://github.com/taskforcesh/bullmq/blob/master/tests%2Ftest_repeat.ts#L1187
for me, if I use key field in repeat options, it would result in this behavior,
removing key field will solve this issue.
before:
const repeat: RepeatOptions = {every: 10_000, key: 'any-random-key'}
after:
const repeat: RepeatOptions = {every: 10_000}
can't say the same for cron pattern because I didn't use it.
Note:
- bullmq version v5.9.0.
- redis: dragonflydb
pls folks try v5.10.0 where repeatable jobs were refactored and let us know
@roggervalf I can confirm that this works with the new repeat job format that was introduced in 5.10.x 👍🏼