Multiple cron job in a queue
Created by: sudhirbitsgoa
Hi, Thanks for the great library.
Issue steps
create file: cron1.js
var Queue = require('bull');
var cronDelay = new Queue('cronDelay');
cronDelay.add({
everysec: 'every1sec'
}, {
delay: 100,
repeat: {
cron: '*/1 * * * * *'
}
}).catch(err => console.log(err))
cronDelay.process(5, (job, done) => {
console.log('%j', job.data);
done()
});
this will create a job cronDelay and adds a cron job of every 5 secs
create file cron2.js
var Queue = require('bull');
var cronDelay = new Queue('cronDelay');
cronDelay.add({
everysec: 'every5sec'
}, {
delay: 100,
repeat: {
cron: '*/5 * * * * *'
}
}).catch(err => console.log(err))
cronDelay.process(5, (job, done) => {
console.log('%j', job.data);
done()
});
This will add cron job of every 5 sec to the same queue
Issue: when i run
node cron1.js
it keeps printing
{"everysec":"every1sec"}
{"everysec":"every1sec"}
{"everysec":"every1sec"}
{"everysec":"every1sec"}
{"everysec":"every1sec"}
Now in other terminal run
node cron2.js
It just prints
{"everysec":"every5sec"}
for one time and both the jobs are stopped from then.
Any clue what is wrong.