Esempio n. 1
0
 /**
  * {@inheritdoc}
  */
 public function syncScheduledJobs()
 {
     while (!empty($this->removedJobs)) {
         $job = array_shift($this->removedJobs);
         if ($this->scheduler !== NULL) {
             $this->scheduler->removeJob($job);
         }
     }
     while (!empty($this->scheduledJobs)) {
         $job = array_shift($this->scheduledJobs);
         if ($this->scheduler !== NULL) {
             $this->scheduler->scheduleJob($job);
             continue;
         }
         if ($job->getRunAt() === NULL) {
             $this->engine->warning('Cannot schedule job of type "{handler}" within {execution} to run immediately', ['handler' => $job->getHandlerType(), 'execution' => (string) $job->getExecutionId()]);
         } else {
             $this->engine->warning('Cannot schedule job of type "{handler}" within {execution} to run at {scheduled}', ['handler' => $job->getHandlerType(), 'execution' => (string) $job->getExecutionId(), 'scheduled' => $job->getRunAt()->format(\DateTime::ISO8601)]);
         }
     }
 }