public function heartbeat()
    {
        $state = $this->worker->getState();
        if (!in_array($state, array(Worker::BUSY, Worker::READY))) {
            return;
        }

        // Detect manager crash.
        $timeout = 2500;
        if (!$this->worker->isExpired($timeout)) {
            // Worker is pretty active no heartbeat required.
            return;
        }

        if ($this->isWorkerHandlerReady()) {
            // Send a heartbeat.
            $this->sendToWorkerHandler(new Protocol\Heartbeat());

            return;
        }

        $expiry = 5000 + $this->delay;
        if (!$this->worker->isExpired($expiry)) {
            return;
        }

        // Expired, manager already destroyed this instance.
        $this->worker->setState(Worker::INVALID);
    }
public function heartbeat()
    {
        $state = $this->worker->getState();
        if (!in_array($state, array(Worker::BUSY, Worker::READY))) {
            return;
        }

        // Detect manager crash.
        $timeout = 2500;
        if (!$this->worker->isExpired($timeout)) {
            // Worker is pretty active no heartbeat required.
            return;
        }

        if ($this->isWorkerHandlerReady()) {
            // Send a heartbeat.
            $this->sendToWorkerHandler(new Protocol\Heartbeat());

            return;
        }

        $expiry = 5000 + $this->delay;
        if (!$this->worker->isExpired($expiry)) {
            return;
        }

        // Expired, manager already destroyed this instance.
        $this->worker->setState(Worker::INVALID);
    }
public function heartbeat ( ) { $ state = $ this -> worker -> getState ( ) ; if ( ! in_array ( $ state , array ( Worker :: BUSY , Worker :: READY ) ) ) { return ; } // Detect manager crash. $ timeout = 2500 ; if ( ! $ this -> worker -> isExpired ( $ timeout ) ) { // Worker is pretty active no heartbeat required. return ; } if ( $ this -> isWorkerHandlerReady ( ) ) { // Send a heartbeat. $ this -> sendToWorkerHandler ( new Protocol \ Heartbeat ( ) ) ; return ; } $ expiry = 5000 + $ this -> delay ; if ( ! $ this -> worker -> isExpired ( $ expiry ) ) { return ; } // Expired, manager already destroyed this instance. $ this -> worker -> setState ( Worker :: INVALID ) ; }
Performs a heartbeat with the Worker Handler.
Performs a heartbeat with the Worker Handler .