Bull: Can I use bull to schedule a job to run just *once* at a specific date/time like Agenda?

Created on 10 May 2018  ·  4Comments  ·  Source: OptimalBits/bull

question

Most helpful comment

You have to substract the current time from the desired time:

const delay = (new Date("2019/10/05") - new Date())

All 4 comments

Just delay the job until the point in time you need it to be executed.

Thanks @manast. Would you mind providing an example? I’m not sure I follow.

In agenda, I simply call a function called “schedule”.

agenda.schedule(new Date(1530446400), 'printAnalyticsReport');

Would it be job.add(‘printAnalyticsReport’, { delay: 1530446400 })?

You have to substract the current time from the desired time:

const delay = (new Date("2019/10/05") - new Date())
Was this page helpful?
0 / 5 - 0 ratings

Related issues

ianstormtaylor picture ianstormtaylor  ·  4Comments

sibelius picture sibelius  ·  3Comments

pintocarlos picture pintocarlos  ·  3Comments

sarneeh picture sarneeh  ·  3Comments

rodrigoords picture rodrigoords  ·  4Comments