Skip to content

Commit 18056f4

Browse files
Subtract inapplicable suppressed notifications at a later point
Without this commit, every time the NotificationTimerHandler runs it will discard notifications that don't apply to the reason of the latest check result. This is probably intended to clear outdated suppressed notifications immediately when the TimePeriod resumes, but it also clears out important ones (see the test case). This commit fixes that by clearing out inapplicable notifications when the timer runs the first time after the TimePeriod resumes. By that time we can expect that no new suppressed notifications will be added and all notifications that don't conflict with the last check-result can still be run. Fixes #10575
1 parent 03d6f6d commit 18056f4

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

lib/notification/notificationcomponent.cpp

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -83,13 +83,6 @@ 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-
}
92-
9386
if (suppressedTypes) {
9487
auto tp (notification->GetPeriod());
9588

@@ -98,6 +91,11 @@ void FireSuppressedNotifications(const Notification::Ptr& notification)
9891
if (!(suppressedTypes & type) || checkable->NotificationReasonSuppressed(type))
9992
continue;
10093

94+
if ((suppressedTypes & type) && !checkable->NotificationReasonApplies(type)) {
95+
subtract |= type;
96+
suppressedTypes &= ~type;
97+
}
98+
10199
auto notificationName (notification->GetName());
102100

103101
Log(LogNotice, "NotificationComponent")

0 commit comments

Comments
 (0)