function timerTick() {
        foreach($this->workers as $pos => $worker) {
            if(!$worker->isRunning()) {
                $this->loop->futureTick(function () use ($worker) {
                    $this->stopWorker($worker);
                });
                
                continue;
            }
            
            $msgs = $worker->getMessages();
            while($message = $msgs->shift()) {
                $this->handleMessage($worker, $message);
            }
        }
        
        foreach($this->busyWorkers as $worker) {
            if($worker->getStacked() === 0) {
                if($this->workQueue->count() > 0) {
                    /** @var \CharlotteDunois\Phoebe\InternalWork  $work */
                    $work = $this->workQueue->dequeue();
                    
                    $worker->stack($work->getWork());
                    
                    if($this->messenger->usesSockets()) {
                        $msg = new \CharlotteDunois\Phoebe\Message('internal-worker-stack-increased', null);
                        $this->sendMessageToWorker($worker, $msg);
                    }
                    
                    $work->getDeferred()->resolve($worker);
                    continue;
                }
                
                $this->busyWorkers->delete($worker);
                $this->freeWorkers->enqueue($worker);
            }
        }
        
        if(!$this->lastTime || (\time() - $this->lastTime) >= ($this->options['internalTimerTick'] ?? 30)) {
            $this->lastTime = \time();
            $this->internalTimerTick();
        }
    }
function timerTick() {
        foreach($this->workers as $pos => $worker) {
            if(!$worker->isRunning()) {
                $this->loop->futureTick(function () use ($worker) {
                    $this->stopWorker($worker);
                });
                
                continue;
            }
            
            $msgs = $worker->getMessages();
            while($message = $msgs->shift()) {
                $this->handleMessage($worker, $message);
            }
        }
        
        foreach($this->busyWorkers as $worker) {
            if($worker->getStacked() === 0) {
                if($this->workQueue->count() > 0) {
                    /** @var \CharlotteDunois\Phoebe\InternalWork  $work */
                    $work = $this->workQueue->dequeue();
                    
                    $worker->stack($work->getWork());
                    
                    if($this->messenger->usesSockets()) {
                        $msg = new \CharlotteDunois\Phoebe\Message('internal-worker-stack-increased', null);
                        $this->sendMessageToWorker($worker, $msg);
                    }
                    
                    $work->getDeferred()->resolve($worker);
                    continue;
                }
                
                $this->busyWorkers->delete($worker);
                $this->freeWorkers->enqueue($worker);
            }
        }
        
        if(!$this->lastTime || (\time() - $this->lastTime) >= ($this->options['internalTimerTick'] ?? 30)) {
            $this->lastTime = \time();
            $this->internalTimerTick();
        }
    }
function timerTick ( ) { foreach ( $ this -> workers as $ pos => $ worker ) { if ( ! $ worker -> isRunning ( ) ) { $ this -> loop -> futureTick ( function ( ) use ( $ worker ) { $ this -> stopWorker ( $ worker ) ; } ) ; continue ; } $ msgs = $ worker -> getMessages ( ) ; while ( $ message = $ msgs -> shift ( ) ) { $ this -> handleMessage ( $ worker , $ message ) ; } } foreach ( $ this -> busyWorkers as $ worker ) { if ( $ worker -> getStacked ( ) === 0 ) { if ( $ this -> workQueue -> count ( ) > 0 ) { /** @var \CharlotteDunois\Phoebe\InternalWork  $work */ $ work = $ this -> workQueue -> dequeue ( ) ; $ worker -> stack ( $ work -> getWork ( ) ) ; if ( $ this -> messenger -> usesSockets ( ) ) { $ msg = new \ CharlotteDunois \ Phoebe \ Message ( 'internal-worker-stack-increased' , null ) ; $ this -> sendMessageToWorker ( $ worker , $ msg ) ; } $ work -> getDeferred ( ) -> resolve ( $ worker ) ; continue ; } $ this -> busyWorkers -> delete ( $ worker ) ; $ this -> freeWorkers -> enqueue ( $ worker ) ; } } if ( ! $ this -> lastTime || ( \ time ( ) - $ this -> lastTime ) >= ( $ this -> options [ 'internalTimerTick' ] ?? 30 ) ) { $ this -> lastTime = \ time ( ) ; $ this -> internalTimerTick ( ) ; } }
Timer tick. Used when using the timer implementation.
@return void
@internal
Timer tick . Used when using the timer implementation .