Description
Since version 1.6.7 changes the resumeOnRestart conditions are not matching with the state of the jobs that are running, when the application is restarted.
Current conditions:
$or: [
{
lockedAt: { $exists: true },
nextRunAt: { $ne: null },
$or: [{ $expr: { $eq: ['$runCount', '$finishedCount'] } }, { lastFinishedAt: { $exists: false } }],
},
{
lockedAt: { $exists: false },
lastFinishedAt: { $exists: false },
nextRunAt: { $lte: now, $ne: null },
},
],
The actual state of the jobs:
{ "_id": { "$oid": "67ee497097744eaf758af160" }, "data": { "sample": "true" }, "name": "LONG_RUNNING_JOB", "attempts": 5, "backoff": { "type": "exponential", "delay": 300000 }, "lastModifiedBy": null, "nextRunAt": null, "priority": 0, "shouldSaveResult": true, "type": "normal", "lockedAt": null, "lastRunAt": { "$date": "2025-04-03T08:40:16.033Z" } }
Downgrading to 1.6.6 is resolving the issue, but we don't want to stick with that version
Code example
No response
Additional context
No response