예제 #1
0
 public function beforeExecute(Event $event, Job $job)
 {
     if ($this->_worker && ($this->_worker->status === WorkersTable::STATUS_SHUTDOWN || $this->_worker->status === WorkersTable::STATUS_TO_KILL)) {
         $event->stopPropagation();
         return false;
     }
     cli_set_process_title(sprintf('DJ Worker :: %s :: Working %s', $this->_workerId, $job->getId()));
     $this->out(__('<success>Starting job:</success> {0} :: ', $job->getId()), 1, Shell::VERBOSE);
     $this->out(sprintf(' - <info>%s</info>', $job->getWorker()), 1, Shell::VERBOSE);
     $this->out(' - Executing job', 1, Shell::VERBOSE);
     $job->setHostName($this->_hostName);
     pcntl_signal_dispatch();
     $this->_timeLastJob = microtime(true);
     return true;
 }