Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bull MQ repeatable job not triggering

This question is in continuation with this thread Repeatable jobs not getting triggered at given cron timing in Bull

I am also facing the same problem. How should I specify the timezone? I tried to specify as

repeat: { cron: '* 7 14 * * *', tz: 'Europe/Berlin'}

Meaning trigger the job at 14:07 German time zone. Though the job is listed in the queue, but the job is not triggered.

I also tried repeat:

{
   cron: '* 50 15 * * *', 
   offset: datetime.getTimezoneOffset(), 
   tz: 'Europe/Berlin'
}
like image 674
vinaykumar budanurmath Avatar asked Nov 15 '25 18:11

vinaykumar budanurmath


1 Answers

I finally figured out the solution.

One thing to note is that I had not initialized a Queuescheduler instance. Ofcourse timezone also plays a crucial role. But without a Queuescheduler instance (which has the same name as the Queue), the jobs doesnt get added into the queue. The Queuescheduler instance acts as a book keeper. Also take care about one more important parameter "limit". If you dont set the limit to 1, then the job which is scheduled at a particular time will get triggered unlimited number of times.

For example: To run a job at german time 22:30 every day the configuration would look like:

    repeat: { 
        cron: '* 30 22 * * *',
        offset: datetime.getTimezoneOffset(),
        tz: 'Europe/Berlin',
        limit: 1
    }

Reference: https://docs.bullmq.io/guide/queuescheduler In this above link, the documentation clearly mentions that the queuescheduler instance does the book keeping of the jobs.

In this link - https://docs.bullmq.io/guide/jobs/repeatable, the documentation specifically warns us to ensure that we instantiate a Queuescheduler instance.

like image 93
vinaykumar budanurmath Avatar answered Nov 17 '25 08:11

vinaykumar budanurmath