From 687153b194f1a02fcd28eecdde09e37c3bb66a4b Mon Sep 17 00:00:00 2001 From: Tobias von der Krone Date: Thu, 23 Mar 2017 07:44:42 +0100 Subject: [PATCH] Execute initial checks immediately refs #5083 --- lib/icinga/checkable-check.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/icinga/checkable-check.cpp b/lib/icinga/checkable-check.cpp index aa513a95ab6..da0c577e889 100644 --- a/lib/icinga/checkable-check.cpp +++ b/lib/icinga/checkable-check.cpp @@ -67,7 +67,7 @@ void Checkable::UpdateNextCheck(const MessageOrigin::Ptr& origin) { double interval; - if (GetStateType() == StateTypeSoft && GetLastCheckResult() != NULL) + if (GetStateType() == StateTypeSoft && HasBeenChecked()) interval = GetRetryInterval(); else interval = GetCheckInterval(); @@ -80,7 +80,10 @@ void Checkable::UpdateNextCheck(const MessageOrigin::Ptr& origin) adj = std::min(0.5 + fmod(GetSchedulingOffset(), interval * 5) / 100.0, adj); - SetNextCheck(now - adj + interval, false, origin); + if (HasBeenChecked()) + SetNextCheck(now - adj + interval, false, origin); + else + SetNextCheck(now, false, origin); } bool Checkable::HasBeenChecked(void) const