Adding new job after second removal with removeRepeatable fails
Created by: tdzienniak
Code ilustrating the issue:
const Queue = require('bull');
const testQueue = new Queue('test');
testQueue.process(function(job) {
console.log('Work, work!');
});
const init = async () => {
await testQueue.add('myTestJob', {
data: '1',
}, {
repeat: {
cron: '* * * * *',
},
});
console.log((await testQueue.getDelayed()).length); // 1
await testQueue.removeRepeatable('myTestJob', {
cron: '* * * * *'
})
console.log((await testQueue.getDelayed()).length); // 0
await testQueue.add('myTestJob', {
data: '2',
}, {
repeat: {
cron: '*/5 * * * *',
},
});
console.log((await testQueue.getDelayed()).length); // 1
await testQueue.removeRepeatable('myTestJob', {
cron: '*/5 * * * *'
})
console.log((await testQueue.getDelayed()).length); // 0
await testQueue.add('myTestJob', {
data: '2',
}, {
repeat: {
cron: '*/5 * * * *',
},
});
console.log((await testQueue.getDelayed()).length); // 0, but should be one
}
init();
As you can see, after first removal with removeRepeatable
job is added just fine, but after seconde removal job is not added at all. This is very critical issue in my use case.