When using a crontab like "5 * * * *" (which equals to 5 minutes after every full hour) then the first calculation of the next timestamp to execute is failing in most cases.

Lets say it's 17:09. The outer loop in JobSchedulerCronTab::nextHour() goes into the inner queue with hour=17 and the inner queue pulls the only item "5" from the minutes array.

So, the first step to correct this is to copy the minutes array into a working array so that the original array is again avaiable when getting into the inner queue next time.

But the second problem is that even for later hours, the current minute (=9) is always greater than the wanted value (=5) so we will not get any of the next hours on the current day.

Attached is a small patch that resolves both problems and I hope you will be committing this to the dev branch.

CommentFileSizeAuthor
JobSchedulerCronTab.inc_.patch720 bytesjurgenhaas
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

makara’s picture

Please see #1137378: JobSchedulerCronTab->nextHour() doesn't work properly for specified minutes and please test the Git version.

Let us know if the errors are still there.

twistor’s picture

Status: Needs review » Closed (duplicate)