Merge pull request #10239 from Icinga/state-before-suppression214

Fix lost recovery notifications after recovery outside of notification time period
This commit is contained in:
Yonas Habteab 2024-11-14 13:49:15 +01:00 committed by GitHub
commit 6f9ae05948
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -203,7 +203,7 @@ void Checkable::FireSuppressedNotifications()
* If any of these conditions is not met, processing the suppressed notification is further delayed. * If any of these conditions is not met, processing the suppressed notification is further delayed.
*/ */
if (!state_suppressed && GetStateType() == StateTypeHard && !IsLikelyToBeCheckedSoon() && !wasLastParentRecoveryRecent.Get()) { if (!state_suppressed && GetStateType() == StateTypeHard && !IsLikelyToBeCheckedSoon() && !wasLastParentRecoveryRecent.Get()) {
if (NotificationReasonApplies(type)) { if (cr->GetState() != GetStateBeforeSuppression()) {
Checkable::OnNotificationsRequested(this, type, cr, "", "", nullptr); Checkable::OnNotificationsRequested(this, type, cr, "", "", nullptr);
} }
subtract |= NotificationRecovery|NotificationProblem; subtract |= NotificationRecovery|NotificationProblem;
@ -266,12 +266,12 @@ bool Checkable::NotificationReasonApplies(NotificationType type)
case NotificationProblem: case NotificationProblem:
{ {
auto cr (GetLastCheckResult()); auto cr (GetLastCheckResult());
return cr && !IsStateOK(cr->GetState()) && cr->GetState() != GetStateBeforeSuppression(); return cr && !IsStateOK(cr->GetState());
} }
case NotificationRecovery: case NotificationRecovery:
{ {
auto cr (GetLastCheckResult()); auto cr (GetLastCheckResult());
return cr && IsStateOK(cr->GetState()) && cr->GetState() != GetStateBeforeSuppression(); return cr && IsStateOK(cr->GetState());
} }
case NotificationFlappingStart: case NotificationFlappingStart:
return IsFlapping(); return IsFlapping();