示例#1
0
 /**
  * Notify Redis that we've finished working on a job, clearing the working
  * state and incrementing the job stats.
  */
 public function doneWorking()
 {
     Event::fire(Event::WORKER_DONE_WORKING, array($this, $this->job));
     $this->redis->hmset(self::redisKey($this), array('job_id' => '', 'job_pid' => 0, 'job_started' => 0));
     switch ($this->job->getStatus()) {
         case Job::STATUS_COMPLETE:
             $this->redis->hincrby(self::redisKey($this), 'processed', 1);
             break;
         case Job::STATUS_CANCELLED:
             $this->redis->hincrby(self::redisKey($this), 'cancelled', 1);
             break;
         case Job::STATUS_FAILED:
             $this->redis->hincrby(self::redisKey($this), 'failed', 1);
             break;
     }
     $this->job = null;
 }