getQuantity() public method

public getQuantity ( )
Exemplo n.º 1
0
 public function testGetQuantity()
 {
     $func = function () {
         exit;
     };
     $configData = array('worker' => $func, 'quantity' => 10);
     $config = new Config($configData);
     $this->assertEquals(10, $config->getQuantity());
 }
Exemplo n.º 2
0
 /**
  * @return void
  */
 public function keep()
 {
     Logger::debug(__METHOD__ . '()');
     $this->_stoped = false;
     try {
         while (!$this->_stoped) {
             if (\count($this->_children) < $this->_config->getQuantity()) {
                 $this->_startOne();
                 continue;
             }
             $status = null;
             $pid = \pcntl_wait($status, \WNOHANG);
             if ($pid > 0) {
                 $this->_processExit($pid);
                 continue;
             }
             $this->_checkTimeout();
             \usleep($this->_checkingInterval);
         }
     } catch (StopSignal $ex) {
         Logger::info('Received a StopSignal');
         $this->_waitToEnd();
     }
 }