isKillingOnTimeoutEnabled() public méthode

public isKillingOnTimeoutEnabled ( ) : boolean
Résultat boolean
Exemple #1
0
 /**
  *
  * @throws \Comos\Qpm\Process\Exception
  * @return boolean
  */
 public function dealWithTimeout()
 {
     if (!$this->isTimeout()) {
         return false;
     }
     if ($this->isDealedWithTimeout) {
         if (!$this->config->isKillingOnTimeoutEnabled()) {
             $this->dealWithTermTimeout();
         }
         return false;
     }
     $this->isDealedWithTimeout = true;
     Logger::info("process[" . $this->getProcess()->getPid() . "] will be terminated for timeout");
     $this->invokeOnTimeout();
     try {
         if ($this->config->isKillingOnTimeoutEnabled()) {
             $this->getProcess()->kill();
         } else {
             $this->termTime = microtime(true);
             $this->getProcess()->terminate();
         }
     } catch (\Exception $e) {
         Logger::err($e);
         return false;
     }
     return true;
 }
Exemple #2
0
 /**
  * @dataProvider dataProviderOfTermTimeout
  */
 public function testTermTimeout($termTimeout, $expectedIsKillOnTimeout, $expectedTermTimeout)
 {
     $config = new Config(array('termTimeout' => $termTimeout, 'worker' => function () {
     }));
     $this->assertEquals($expectedTermTimeout, $config->getTermTimeout());
     $this->assertEquals($expectedIsKillOnTimeout, $config->isKillingOnTimeoutEnabled());
 }