Exemple #1
0
 public function shutdown()
 {
     if (!$this->currentTask) {
         return;
     }
     if ($err = error_get_last()) {
         $this->logger->err(sprintf('Worker died while working on task %s. Last error "%s" occurred in %s on line %d.', $this->currentTask, $err['message'], $err['file'], $err['line']));
     }
     if (!$this->isCurrentTaskProcessed) {
         if ($this->currentTask->reschedule()) {
             $this->currentQueue->push($this->currentTask);
         } else {
             $this->logger->err(sprintf('Task %s failed.', $this->currentTask));
         }
     }
 }