Job::reschedule() uses the value nextrun + interval when calculating the new time to run the job.
https://github.com/humanmade/Cavalcade-Runner/blob/master/inc/class-job.php#L84
This causes the jobs to run constantly if the task is originally scheduled before the current timestamp until nextrun + interval is after the current time stamp.
To reproduce schedule an event with wp_schedule_event( 0, 'hourly', 'pwcc_every_hour' ) as a shorthand way of setting the task to start immediately and then once every hour. The outcome is:
- the action
pwcc_every_hour fires 426,388 consecutively
- the action
pwcc_every_hour continues firing once each hour
A better approach would be to record the start time when the lock is obtained and add the interval to that when rescheduling.
Job::reschedule()uses the valuenextrun + intervalwhen calculating the new time to run the job.https://github.com/humanmade/Cavalcade-Runner/blob/master/inc/class-job.php#L84
This causes the jobs to run constantly if the task is originally scheduled before the current timestamp until
nextrun + intervalis after the current time stamp.To reproduce schedule an event with
wp_schedule_event( 0, 'hourly', 'pwcc_every_hour' )as a shorthand way of setting the task to start immediately and then once every hour. The outcome is:pwcc_every_hourfires 426,388 consecutivelypwcc_every_hourcontinues firing once each hourA better approach would be to record the start time when the lock is obtained and add the interval to that when rescheduling.