CoreApi: old patch, unused code

This commit is contained in:
Thomas Gelf 2018-05-29 22:22:13 +02:00
parent 8c432285e7
commit cf5b7c7001
1 changed files with 9 additions and 2 deletions

View File

@ -150,6 +150,13 @@ class CoreApi implements DeploymentApiInterface
public function checkHostAndWaitForResult($host, $timeout = 10) public function checkHostAndWaitForResult($host, $timeout = 10)
{ {
$object = $this->getObject($host, 'hosts');
if (isset($object->attrs->last_check_result)) {
$oldOutput = $object->attrs->last_check_result->output;
} else {
$oldOutput = '';
}
$now = microtime(true); $now = microtime(true);
$this->checkHostNow($host); $this->checkHostNow($host);
@ -158,7 +165,7 @@ class CoreApi implements DeploymentApiInterface
$object = $this->getObject($host, 'hosts'); $object = $this->getObject($host, 'hosts');
if (isset($object->attrs->last_check_result)) { if (isset($object->attrs->last_check_result)) {
$res = $object->attrs->last_check_result; $res = $object->attrs->last_check_result;
if ($res->execution_start > $now) { if ($res->execution_start > $now || $res->output !== $oldOutput) {
return $res; return $res;
} }
} else { } else {
@ -175,7 +182,7 @@ class CoreApi implements DeploymentApiInterface
break; break;
} }
usleep(150000); usleep(50000);
} }
return false; return false;