Skip to content

Commit 5b1a6cf

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 3cbfe17 commit 5b1a6cf

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

lib/notification/notificationcomponent.cpp

Lines changed: 6 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,12 @@ 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+
continue;
98+
}
99+
101100
auto notificationName (notification->GetName());
102101

103102
Log(LogNotice, "NotificationComponent")

0 commit comments

Comments
 (0)