agenda jobs are not running after restart node server

Created on 9 Mar 2020  路  14Comments  路  Source: agenda/agenda

Most helpful comment

Hello Guys,

I was too getting same issue, but got it solved. (I think the catch is how we handle Agenda file structure to start the agenda jobs). So here's my repo where I have created one file structure to schedule jobs(recurring, also used cron pattern).
Its working fine, works after server restarts.

Agenda-task-scheduler

Hope this helps!

Thanks

All 14 comments

I am seeing a similar behavior. A job is defined correctly, with a nextRunAt in the future.
After restarting the node process that hosts agenda, it never picks it up from the DB.

The 'start' event is not fired when the time comes. In order to get the thing working as expected again I am forced to run agenda.define(prev_job_name, prev_job_definition)...

I have tried with an alternate solution. Before start node server filter not started jobs and update nextRunAt to new Date() ;

I am noticing it too

can confirm.

I can also report this is an issue that has been around for a while (since at least v0.9.1).
Test cases aren't catching this one.

Any updates in regards to this? Seems like this library is inherently flawed if one has to manually redefine all the already existing tasks each time the server restarts...

I am facing the same issue. Scheduled jobs do not run after a server restart

Also encountering the same issue. Scheduled jobs do not run after a server restart even when the existing Job's nextRunAt is set to a time after the server restart

Can anyone confirm the fix for this solution, I am facing the same issue. _OR_
Can someone tell me some workaround for the same?

I am also getting the same issue

I'm having the same issue.
I found two solutions.

  1. Get all the jobs from the DB re-create them and remove the old ones.
  2. Modify the current agenda behaviour when the server start in order to avoid the issue
    I don't like neither options. So if anyone has a better solution please post it

Any solution?

Hello Guys,

I was too getting same issue, but got it solved. (I think the catch is how we handle Agenda file structure to start the agenda jobs). So here's my repo where I have created one file structure to schedule jobs(recurring, also used cron pattern).
Its working fine, works after server restarts.

Agenda-task-scheduler

Hope this helps!

Thanks

@farhan711 it was indeed a problem with my structure. thanks! this solved it.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

skotchio picture skotchio  路  16Comments

simison picture simison  路  41Comments

OmgImAlexis picture OmgImAlexis  路  14Comments

sureshballa picture sureshballa  路  17Comments

niftylettuce picture niftylettuce  路  21Comments