Skip to content
Snippets Groups Projects
Commit 2380f18d authored by Kunal Sachdev's avatar Kunal Sachdev Committed by Ted Bowman
Browse files

Issue #3248544 by tedbow, kunal.sachdev: Build in some buffer time when...

Issue #3248544 by tedbow, kunal.sachdev: Build in some buffer time when validating cron frequency based on last run time
parent 64f1ecee
No related branches found
No related tags found
1 merge request!641Issue #3248544: Build in some buffer time when validating cron frequency based on last run time
...@@ -171,12 +171,12 @@ class CronFrequencyValidator implements EventSubscriberInterface { ...@@ -171,12 +171,12 @@ class CronFrequencyValidator implements EventSubscriberInterface {
// installed, defaulting to the beginning of the Unix epoch. // installed, defaulting to the beginning of the Unix epoch.
$cron_last = $this->state->get('system.cron_last', $this->state->get('install_time', 0)); $cron_last = $this->state->get('system.cron_last', $this->state->get('install_time', 0));
// @todo Should we allow a little extra time in case the server job takes // Since 'system.cron_last' is not set until the end of the cron run, allow
// longer than expected? Otherwise a server setup with a 3-hour cron job // a little extra time (600 seconds) in case one cron run takes longer than
// will always give this warning. Maybe this isn't necessary because the // the previous cron run. This could result in the value of
// last cron run time is recorded after cron runs. Address this in // 'system.cron_last' being older than `WARNING_INTERVAL` even if the cron
// https://www.drupal.org/project/automatic_updates/issues/3248544. // frequency is exactly the same as `WARNING_INTERVAL`.
if ($this->time->getRequestTime() - $cron_last > static::WARNING_INTERVAL) { if ($this->time->getRequestTime() - $cron_last > (static::WARNING_INTERVAL + 600)) {
$event->addError([ $event->addError([
$this->t('Cron has not run recently. For more information, see the online handbook entry for <a href=":cron-handbook">configuring cron jobs</a> to run at least every @frequency hours.', [ $this->t('Cron has not run recently. For more information, see the online handbook entry for <a href=":cron-handbook">configuring cron jobs</a> to run at least every @frequency hours.', [
':cron-handbook' => 'https://www.drupal.org/cron', ':cron-handbook' => 'https://www.drupal.org/cron',
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment