You are here

protected function RngCron::deleteScheduleRules in RNG - Events and Registrations 3.x

Same name and namespace in other branches
  1. 8.2 src/RngCron.php \Drupal\rng\RngCron::deleteScheduleRules()
  2. 8 src/RngCron.php \Drupal\rng\RngCron::deleteScheduleRules()

Delete scheduled rules which have had too many attempts.

1 call to RngCron::deleteScheduleRules()
RngCron::hook_cron in src/RngCron.php
React to Drupal `hook_cron` hooks.

File

src/RngCron.php, line 83

Class

RngCron
RNG Cron.

Namespace

Drupal\rng

Code

protected function deleteScheduleRules() {
  $ids = $this->ruleSchedulerStorage
    ->getQuery()
    ->condition('attempts', RuleSchedule::ATTEMPTS_MAX, '>')
    ->execute();

  /** @var \Drupal\rng\Entity\RuleScheduleInterface[] $rule_schedules */
  $rule_schedules = $this->ruleSchedulerStorage
    ->loadMultiple($ids);
  $this->ruleSchedulerStorage
    ->delete($rule_schedules);
}