You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When a Job Scheduler is removed with Queue.removeJobScheduler() and upserted again with Queue.upsertJobScheduler(), no new delayed task is created and the scheduled tasks never run.
Seems like during the upsert, it sees that there is a job with the expected id (based on milis?) that exist already and it doesn't not create a new task. But that task is in 'completed' state already, so it will never run again.
In the example below, we see the next: 1738974600000 in the Job Scheduler, and a task with id: 'repeat:test:1738974600000' already existing.
I've also seen some other strange behavior with Job Schedulers that is harder to reproduce and report. Sometimes the delayed task will not run, and it's scheduled execution time is well in the past.
How to reproduce.
const queue = new Queue('queue')
await queue.upsertJobScheduler('test', { every: 3 * 60 * 1000 }, { name: 'test-job', data: { foo: 'bar' } })
// A while later
// Deletes currently delayed 'test-job' job
await queue.removeJobScheduler('test')
// Does not create the new 'test-job'
await queue.upsertJobScheduler('test', { every: 3 * 60 * 1000 }, { name: 'test-job', data: { foo: 'bar' } })
const schedulers = await queue.getJobSchedulers()
const delayed = await queue.getDelayed()
const completed = await queue.getCompleted()
console.log({schedulers, delayed, completed})
Version
v5.40.2
Platform
NodeJS
What happened?
When a Job Scheduler is removed with
Queue.removeJobScheduler()
and upserted again withQueue.upsertJobScheduler()
, no new delayed task is created and the scheduled tasks never run.Seems like during the upsert, it sees that there is a job with the expected id (based on milis?) that exist already and it doesn't not create a new task. But that task is in 'completed' state already, so it will never run again.
In the example below, we see the
next: 1738974600000
in the Job Scheduler, and a task withid: 'repeat:test:1738974600000'
already existing.I've also seen some other strange behavior with Job Schedulers that is harder to reproduce and report. Sometimes the delayed task will not run, and it's scheduled execution time is well in the past.
How to reproduce.
Relevant log output
Code of Conduct
The text was updated successfully, but these errors were encountered: