Exemplo n.º 1
0
 public function run()
 {
     do {
         if ($this->processManager->getRunningProcessesCount() > 0) {
             $this->processManager->waitNext(false);
         }
         while ($this->processManager->getRunningProcessesCount() < $this->maxWorkers && ($route = $this->getNextRoute())) {
             $this->runWorkerProcess($route);
         }
     } while ($this->isContinue());
 }
Exemplo n.º 2
0
 /**
  * @return bool
  */
 protected function isContinue()
 {
     pcntl_signal_dispatch();
     if ($this->isTerminated) {
         return false;
     }
     if ($this->processManager->getRunningProcessesCount() == 0) {
         if ($this->stopIfNoJob) {
             return false;
         }
         //\Utility::logText('waiting');
         sleep(1);
     }
     return true;
 }