Hello,I'd like to use Bull queue for my backend. I want to repeat a job daily at 8am, I prepared the following example:const Queue = require('bull'); const queue = new Queue('t2', process.env.REDIS_URL); const sleep = delay => new Promise(resolve => setTimeout(() => resolve(), delay)); queue.process(async (_, done) => { console.log('Running task: ' + new Date()); await sleep(1000); done(); }); queue.add({}, { repeat: { cron: '0 8 * * *' } }); Which results in: Running task: Fri Feb 07 2020 21:16:45 GMT+0100 (Central European Standard Time)Running task: Fri Feb 07 2020 21:16:46 GMT+0100 (Central European Standard Time) Running task: Fri Feb 07 2020 21:16:47 GMT+0100 (Central European Standard Time) Running task: Fri Feb 07 2020 21:16:48 GMT+0100 (Central European Standard Time) So as you can see the job is being repeated every second. It does not matter what I add as the repeat option, I could also use every: 5000 and it still executes every second.Anyone got some input for me? Idk what's going on
Submitted February 07, 2020 at 08:17PM by roconf
No comments:
Post a Comment