I am trying to re-create all the expired job at the server start.
(async function() {
await agenda.start();
const jobs = await agenda.jobs({nextRunAt: {$lt: new Date(Date.now())}});
for(var job of jobs){
var { _id, name, data, type, priority, nextRunAt, lastModifiedBy, lockedAt, lastRunAt} = job.attrs;
var newDate = Date.now() + 30000;
await agenda.cancel({_id:_id});
await agenda.schedule(newDate,name,data);
}
})();
However, while the new jobs are saved in the database, they are not executed.
Any idea ?