@@ -83,37 +83,34 @@ void FireSuppressedNotifications(const Notification::Ptr& notification)
8383 int subtract = 0;
8484 auto checkable (notification->GetCheckable());
8585
86- for (auto type : {NotificationProblem, NotificationRecovery, NotificationFlappingStart, NotificationFlappingEnd}) {
87- if ((suppressedTypes & type) && !checkable->NotificationReasonApplies(type)) {
88- subtract |= type;
89- suppressedTypes &= ~type;
90- }
91- }
86+ auto tp (notification->GetPeriod());
9287
93- if (suppressedTypes) {
94- auto tp (notification->GetPeriod());
88+ if ((!tp || tp->IsInside(Utility::GetTime())) && !checkable->IsLikelyToBeCheckedSoon()) {
89+ for (auto type : {NotificationProblem, NotificationRecovery, NotificationFlappingStart, NotificationFlappingEnd}) {
90+ if (!(suppressedTypes & type) || checkable->NotificationReasonSuppressed(type)) {
91+ continue;
92+ }
9593
96- if ((!tp || tp->IsInside(Utility::GetTime())) && ! checkable->IsLikelyToBeCheckedSoon( )) {
97- for (auto type : {NotificationProblem, NotificationRecovery, NotificationFlappingStart, NotificationFlappingEnd}) {
98- if (!(suppressedTypes & type) || checkable->NotificationReasonSuppressed(type))
99- continue;
94+ if (! checkable->NotificationReasonApplies(type )) {
95+ subtract |= type;
96+ continue;
97+ }
10098
101- auto notificationName (notification->GetName());
99+ auto notificationName (notification->GetName());
102100
103- Log(LogNotice, "NotificationComponent")
104- << "Attempting to re-send previously suppressed notification '" << notificationName << "'.";
101+ Log(LogNotice, "NotificationComponent")
102+ << "Attempting to re-send previously suppressed notification '" << notificationName << "'.";
105103
106- subtract |= type;
107- SubtractSuppressedNotificationTypes(notification, subtract);
108- subtract = 0;
109-
110- try {
111- notification->BeginExecuteNotification(type, checkable->GetLastCheckResult(), false, false);
112- } catch (const std::exception& ex) {
113- Log(LogWarning, "NotificationComponent")
114- << "Exception occurred during notification for object '"
115- << notificationName << "': " << DiagnosticInformation(ex, false);
116- }
104+ subtract |= type;
105+ SubtractSuppressedNotificationTypes(notification, subtract);
106+ subtract = 0;
107+
108+ try {
109+ notification->BeginExecuteNotification(type, checkable->GetLastCheckResult(), false, false);
110+ } catch (const std::exception& ex) {
111+ Log(LogWarning, "NotificationComponent")
112+ << "Exception occurred during notification for object '"
113+ << notificationName << "': " << DiagnosticInformation(ex, false);
117114 }
118115 }
119116 }
0 commit comments