protected function monitorPoolProcesses(string $poolName) : bool
    {
        if (empty($this->processes[$poolName])) {
            return true;
        }
        /** @var Process $process */
        foreach ($this->processes[$poolName] as $i => $process) {
            $pid = $process->getPid();
            $workerId = $this->config['server_id'] . '_' . $pid;

            // check if process is still running:
            if ($process->isRunning() === true) {
                continue;
            }

            // if process is not running remove it from system:
            $this->unregisterChildProcess($workerId);
            unset($this->processes[$poolName][$i]);

            // fire up a new process:
            $workerFile = $this->config['pool'][$poolName]['worker_file'];
            $process = $this->startChildProcess($workerFile);
            $this->registerChildProcess($process, $poolName);
        }
        return true;
    }
protected function monitorPoolProcesses(string $poolName) : bool
    {
        if (empty($this->processes[$poolName])) {
            return true;
        }
        /** @var Process $process */
        foreach ($this->processes[$poolName] as $i => $process) {
            $pid = $process->getPid();
            $workerId = $this->config['server_id'] . '_' . $pid;

            // check if process is still running:
            if ($process->isRunning() === true) {
                continue;
            }

            // if process is not running remove it from system:
            $this->unregisterChildProcess($workerId);
            unset($this->processes[$poolName][$i]);

            // fire up a new process:
            $workerFile = $this->config['pool'][$poolName]['worker_file'];
            $process = $this->startChildProcess($workerFile);
            $this->registerChildProcess($process, $poolName);
        }
        return true;
    }
protected function monitorPoolProcesses ( string $ poolName ) : bool { if ( empty ( $ this -> processes [ $ poolName ] ) ) { return true ; } /** @var Process $process */ foreach ( $ this -> processes [ $ poolName ] as $ i => $ process ) { $ pid = $ process -> getPid ( ) ; $ workerId = $ this -> config [ 'server_id' ] . '_' . $ pid ; // check if process is still running: if ( $ process -> isRunning ( ) === true ) { continue ; } // if process is not running remove it from system: $ this -> unregisterChildProcess ( $ workerId ) ; unset ( $ this -> processes [ $ poolName ] [ $ i ] ) ; // fire up a new process: $ workerFile = $ this -> config [ 'pool' ] [ $ poolName ] [ 'worker_file' ] ; $ process = $ this -> startChildProcess ( $ workerFile ) ; $ this -> registerChildProcess ( $ process , $ poolName ) ; } return true ; }
Checks state of every process in pool and restarts processes if necessary.

@param string $poolName
@return bool
Checks state of every process in pool and restarts processes if necessary .