From cf5b7c7001232a46f649f002f718716ab470d0c2 Mon Sep 17 00:00:00 2001 From: Thomas Gelf Date: Tue, 29 May 2018 22:22:13 +0200 Subject: [PATCH] CoreApi: old patch, unused code --- library/Director/Core/CoreApi.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/library/Director/Core/CoreApi.php b/library/Director/Core/CoreApi.php index 3fb94eee..ff81d6b7 100644 --- a/library/Director/Core/CoreApi.php +++ b/library/Director/Core/CoreApi.php @@ -150,6 +150,13 @@ class CoreApi implements DeploymentApiInterface 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); $this->checkHostNow($host); @@ -158,7 +165,7 @@ class CoreApi implements DeploymentApiInterface $object = $this->getObject($host, 'hosts'); if (isset($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; } } else { @@ -175,7 +182,7 @@ class CoreApi implements DeploymentApiInterface break; } - usleep(150000); + usleep(50000); } return false;