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
I have it the schedule set to '59 * * * * *' so that my task runs once a minute. When I have recoverMissedExceutions on, my task is run on 59 but then it is run again on the next second 00. Here is an example where var is the variable passed into the job function and actual is just printing out a new Date() inside the job.
You can see that on the next second after my schedule, it runs it again with the previous second. I believe the culprit is this line https://github.com/node-cron/node-cron/blob/master/src/scheduler.js#L29.
It's doing a lastExecution.getTime() < date_tmp.getTime() which as you can see from my examples is technically true. lastExecutionTime is prior to "now minus 1 second" (what date_tmp is).
I think there needs to be some adjustment to the logic here. I don't think missedExecutions should be 1 in this case but it is. It didn't "miss" anything.
Edit: Actually, it looks like this isn't isolated to once a minute. I just tried it with a * * * * * * and not always, but sometimes it is still running multiple times in the same manner.
I have it the schedule set to
'59 * * * * *'
so that my task runs once a minute. When I haverecoverMissedExceutions
on, my task is run on 59 but then it is run again on the next second 00. Here is an example wherevar
is the variable passed into the job function andactual
is just printing out anew Date()
inside the job.You can see that on the next second after my schedule, it runs it again with the previous second. I believe the culprit is this line https://github.com/node-cron/node-cron/blob/master/src/scheduler.js#L29.
It's doing a
lastExecution.getTime() < date_tmp.getTime()
which as you can see from my examples is technically true.lastExecutionTime
is prior to "now minus 1 second" (what date_tmp is).I think there needs to be some adjustment to the logic here. I don't think
missedExecutions
should be1
in this case but it is. It didn't "miss" anything.Edit: Actually, it looks like this isn't isolated to once a minute. I just tried it with a
* * * * * *
and not always, but sometimes it is still running multiple times in the same manner.The text was updated successfully, but these errors were encountered: