Skip to content
Snippets Groups Projects

Issue #3248544: Build in some buffer time when validating cron frequency based on last run time

Merged Issue #3248544: Build in some buffer time when validating cron frequency based on last run time
1 unresolved thread
1 unresolved thread
1 file
+ 3
6
Compare changes
  • Side-by-side
  • Inline
@@ -171,12 +171,9 @@ class CronFrequencyValidator implements EventSubscriberInterface {
// installed, defaulting to the beginning of the Unix epoch.
$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
// longer than expected? Otherwise a server setup with a 3-hour cron job
// will always give this warning. Maybe this isn't necessary because the
// last cron run time is recorded after cron runs. Address this in
// https://www.drupal.org/project/automatic_updates/issues/3248544.
if ($this->time->getRequestTime() - $cron_last > static::WARNING_INTERVAL) {
// Allowing a little extra time (120 seconds) in case the server job takes
// longer than expected.
    • Comment on lines +174 to +175

      I don't think this gives enough information as to why we need this buffer. I feel like if saw this later I would probably do a git history to find the issue that added this change. And someone not involved in this issue would have no other context.

      I am going to push up a suggested change for others to review.

Please register or sign in to reply
if ($this->time->getRequestTime() - $cron_last > (static::WARNING_INTERVAL + 120)) {
$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.', [
':cron-handbook' => 'https://www.drupal.org/cron',
Loading