Job Schedulers
Job Schedulers replace "repeatable jobs", and are available in v5.16.0 and onwards
// Creates a new Job Scheduler that generates a job every 1000 milliseconds (1 second)
const firstJob = await queue.upsertJobScheduler('my-scheduler-id', {
every: 1000,
});Using Job Templates
// Create jobs every day at 3:15 (am)
const firstJob = await queue.upsertJobScheduler(
'my-scheduler-id',
{ pattern: '0 15 3 * * *' },
{
name: 'my-job-name',
data: { foo: 'bar' },
opts: {
backoff: 3,
attempts: 5,
removeOnFail: 1000,
},
},
);Read more:
Last updated
Was this helpful?