Duplicate Crons don't run on the hour if they run every hour/more than once per hour

Jon W

Well-known member
Affected version
2.0.10
Crons that are due to run every hour/more than once per hour don't run on the hour if that is one of the options. Instead it rolls over to the next slot. So a cron that is due to run on the hour and at 30 minutes past will only ever run at 30 minutes past.

In XF\Service\CronEntry\CalculateNextRun, there is a check for $rollover == null (line 146), where $rollover is set to $unitValue if that is in the past. However, that means that if $unitValue is zero then $rollover == null is true.

The check should be changed to $rollover === null.
 
That is indeed the exact fix that we came up with too, so feel free to use it in the meantime. (Or set it to 1 minute past the hour instead ;))
 
Back
Top Bottom