when running cron job using drush i noticed that disabled jobs also have been run

It seems a problem in `ultimate_cron/src/Entity/CronJob.php`

  public function isScheduled() {
    \Drupal::moduleHandler()->invokeAll('cron_pre_schedule', array($this));
    $result = empty($this->disabled) && !$this->isLocked() && $this->getPlugin('scheduler')
        ->isScheduled($this);
    \Drupal::moduleHandler()->invokeAll('cron_post_schedule', array($this));
    return $result;
  }

`$this->disabled` is not defined and `empty` always `TRUE`

Suggest to change to `empty($this->disabled)` to $this->status()

 $result = $this->status() && !$this->isLocked() && $this->getPlugin('scheduler')->isScheduled($this);
 
CommentFileSizeAuthor
#2 ultimate_cron-3049883.patch666 bytesamme
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

amme created an issue. See original summary.

amme’s picture

amme’s picture

Status: Active » Needs review
Manuel Garcia’s picture

Status: Needs review » Reviewed & tested by the community

This looks good to me, and patch is simple enough.

Berdir’s picture

Status: Reviewed & tested by the community » Fixed

Patches are much more likely to get committed with tests that verify that things are now working as expected. But thanks, committed now.

  • Berdir committed 2621ed1 on 8.x-2.x authored by amme
    Issue #3049883 by amme: Disabled jobs are always running
    

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.