function stopWorker(\CharlotteDunois\Phoebe\Worker $worker) {
        if($worker->isRunning()) {
            try {
                $message = new \CharlotteDunois\Phoebe\Message('internal-worker-exit', null);
                $this->sendMessageToWorker($worker, $message);
            } catch (\RuntimeException $e) {
                /* Continue regardless of error */
            }
            
            $this->checkWorkerShutdown($worker);
        } else {
            $this->messenger->removeWorkerSocket($worker);
            $this->emit('exitWorker', $worker);
        }
        
        $this->removeWorker($worker);
    }
function stopWorker(\CharlotteDunois\Phoebe\Worker $worker) {
        if($worker->isRunning()) {
            try {
                $message = new \CharlotteDunois\Phoebe\Message('internal-worker-exit', null);
                $this->sendMessageToWorker($worker, $message);
            } catch (\RuntimeException $e) {
                /* Continue regardless of error */
            }
            
            $this->checkWorkerShutdown($worker);
        } else {
            $this->messenger->removeWorkerSocket($worker);
            $this->emit('exitWorker', $worker);
        }
        
        $this->removeWorker($worker);
    }
function stopWorker ( \ CharlotteDunois \ Phoebe \ Worker $ worker ) { if ( $ worker -> isRunning ( ) ) { try { $ message = new \ CharlotteDunois \ Phoebe \ Message ( 'internal-worker-exit' , null ) ; $ this -> sendMessageToWorker ( $ worker , $ message ) ; } catch ( \ RuntimeException $ e ) { /* Continue regardless of error */ } $ this -> checkWorkerShutdown ( $ worker ) ; } else { $ this -> messenger -> removeWorkerSocket ( $ worker ) ; $ this -> emit ( 'exitWorker' , $ worker ) ; } $ this -> removeWorker ( $ worker ) ; }
Stops a worker correctly and gracefully.
@param \CharlotteDunois\Phoebe\Worker  $worker
@return void
Stops a worker correctly and gracefully .