Remove repeatable jobs does not remove the next repeatable job
Created by: KidkArolis
Here's my queue state in redis after adding repeatable jobs to the queue:
127.0.0.1:6379> keys *
1) "hmns:dev:bull:events:repeat"
2) "hmns:dev:bull:events:repeat:b5230d67db4ca2b571297e5f6cc5db8d:1584370800000"
3) "hmns:dev:bull:events:repeat:ba0b04b62c1854a6669fea27137765a9:1584369000000"
4) "hmns:dev:bull:events:delayed"
5) "hmns:dev:bull:events:stalled-check"
6) "hmns:dev:bull:events:id"
127.0.0.1:6379> zrange hmns:dev:bull:events:repeat 0 100
1) "clean::::30 * * * *"
2) "kick::::0 * * * *"
And now I run:
for (const repeatable of await queue.getRepeatableJobs()) {
await queue.removeRepeatableByKey(repeatable.key)
}
And the state is updated to:
127.0.0.1:6379> keys *
1) "hmns:dev:bull:events:repeat:b5230d67db4ca2b571297e5f6cc5db8d:1584370800000"
2) "hmns:dev:bull:events:repeat:ba0b04b62c1854a6669fea27137765a9:1584369000000"
3) "hmns:dev:bull:events:delayed"
4) "hmns:dev:bull:events:stalled-check"
5) "hmns:dev:bull:events:id"
As you can see, the hmns:dev:bull:events:repeat
has been removed, but the 2 repeat
jobs aren't. I'm not sure this is the intended behaviour and what side effects this could cause.
Seems to be related to how the repeatJobId is being generated without millis here: https://github.com/OptimalBits/bull/blob/ec8ad57ecc6bd111097fb341be955fa68356e221/lib/repeatable.js#L103