Пример #1
0
 /**
  * Update the status indicator for the current worker with a new status.
  *
  * @param int $status The status of the worker
  */
 public function setStatus($status)
 {
     $this->redis->hset(self::redisKey($this), 'status', $status);
     $oldstatus = $this->status;
     $this->status = $status;
     switch ($status) {
         case self::STATUS_NEW:
             break;
         case self::STATUS_RUNNING:
             if ($oldstatus != self::STATUS_NEW) {
                 Event::fire(Event::WORKER_RESUME, $this);
             }
             break;
         case self::STATUS_PAUSED:
             Event::fire(Event::WORKER_PAUSE, $this);
             break;
     }
 }