/**
*
* @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;
}