diff --git a/lib/icinga/checkable-check.cpp b/lib/icinga/checkable-check.cpp index ff9b1a266..7963f675e 100644 --- a/lib/icinga/checkable-check.cpp +++ b/lib/icinga/checkable-check.cpp @@ -239,20 +239,6 @@ void Checkable::ProcessCheckResult(const CheckResult::Ptr& cr, const MessageOrig } } - if (recovery) { - for (auto& child : children) { - if (child->GetProblem() && child->GetEnableActiveChecks()) { - auto nextCheck (now + Utility::Random() % 60); - - ObjectLock oLock (child); - - if (nextCheck < child->GetNextCheck()) { - child->SetNextCheck(nextCheck); - } - } - } - } - if (!reachable) SetLastStateUnreachable(cr->GetExecutionEnd()); @@ -280,20 +266,6 @@ void Checkable::ProcessCheckResult(const CheckResult::Ptr& cr, const MessageOrig (GetAcknowledgement() == AcknowledgementSticky && IsStateOK(new_state))) { ClearAcknowledgement(""); } - - /* reschedule direct parents */ - for (const Checkable::Ptr& parent : GetParents()) { - if (parent.get() == this) - continue; - - if (!parent->GetEnableActiveChecks()) - continue; - - if (parent->GetNextCheck() >= now + parent->GetRetryInterval()) { - ObjectLock olock(parent); - parent->SetNextCheck(now); - } - } } bool remove_acknowledgement_comments = false; @@ -415,6 +387,36 @@ void Checkable::ProcessCheckResult(const CheckResult::Ptr& cr, const MessageOrig << "% current: " << GetFlappingCurrent() << "%."; #endif /* I2_DEBUG */ + if (recovery) { + for (auto& child : children) { + if (child->GetProblem() && child->GetEnableActiveChecks()) { + auto nextCheck (now + Utility::Random() % 60); + + ObjectLock oLock (child); + + if (nextCheck < child->GetNextCheck()) { + child->SetNextCheck(nextCheck); + } + } + } + } + + if (stateChange) { + /* reschedule direct parents */ + for (const Checkable::Ptr& parent : GetParents()) { + if (parent.get() == this) + continue; + + if (!parent->GetEnableActiveChecks()) + continue; + + if (parent->GetNextCheck() >= now + parent->GetRetryInterval()) { + ObjectLock olock(parent); + parent->SetNextCheck(now); + } + } + } + OnNewCheckResult(this, cr, origin); /* signal status updates to for example db_ido */