Пример #1
0
 /**
  * Rerun current job
  */
 protected function rerun()
 {
     $rerunNextStep = empty($this->data['rerunStep']) ? 1 : intval($this->data['rerunStep']) + 1;
     if ($rerunNextStep <= $this->maxStepOfRerun) {
         JobFabric::getInstance()->createJob((new TypedBuilder())->setType($this->type)->setData($this->data)->setRerunStep($rerunNextStep)->setStart(time() + $this->getFibonacciDelay($rerunNextStep))->setOriginal($this->_id));
     }
 }
Пример #2
0
 public function run()
 {
     $job = JobFabric::getInstance()->getJob($this->jobId);
     if ($job instanceof JobBase) {
         $job->run();
     } else {
         throw new Exception('Bad job id');
     }
 }