Make sure that event handlers are run for hard recoveries

fixes #6686
This commit is contained in:
Gunnar Beutner 2014-07-22 14:13:21 +02:00
parent 20c16a8e93
commit 2d6ed4c9be
1 changed files with 4 additions and 4 deletions

View File

@ -250,7 +250,7 @@ void Checkable::ProcessCheckResult(const CheckResult::Ptr& cr, const MessageOrig
ServiceState old_state = GetStateRaw(); ServiceState old_state = GetStateRaw();
StateType old_stateType = GetStateType(); StateType old_stateType = GetStateType();
long old_attempt = GetCheckAttempt(); long old_attempt = GetCheckAttempt();
bool recovery; bool recovery = false;
if (old_cr && cr->GetExecutionStart() < old_cr->GetExecutionStart()) if (old_cr && cr->GetExecutionStart() < old_cr->GetExecutionStart())
return; return;
@ -264,7 +264,6 @@ void Checkable::ProcessCheckResult(const CheckResult::Ptr& cr, const MessageOrig
long attempt = 1; long attempt = 1;
if (!old_cr) { if (!old_cr) {
recovery = false;
SetStateType(StateTypeHard); SetStateType(StateTypeHard);
} else if (cr->GetState() == ServiceOK) { } else if (cr->GetState() == ServiceOK) {
if (old_state == ServiceOK && old_stateType == StateTypeSoft) { if (old_state == ServiceOK && old_stateType == StateTypeSoft) {
@ -272,6 +271,9 @@ void Checkable::ProcessCheckResult(const CheckResult::Ptr& cr, const MessageOrig
recovery = true; recovery = true;
} }
if (old_state != ServiceOK)
recovery = true; // NOT OK -> SOFT/HARD OK
ResetNotificationNumbers(); ResetNotificationNumbers();
SetLastStateOK(Utility::GetTime()); SetLastStateOK(Utility::GetTime());
} else { } else {
@ -284,8 +286,6 @@ void Checkable::ProcessCheckResult(const CheckResult::Ptr& cr, const MessageOrig
attempt = old_attempt; attempt = old_attempt;
} }
recovery = false;
switch (cr->GetState()) { switch (cr->GetState()) {
case ServiceOK: case ServiceOK:
/* Nothing to do here. */ /* Nothing to do here. */