Fix lost recovery notifications after recovery outside of notification time period #10239
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This fixes an issue where recovery notifications get lost if they happen outside of a notification time period.
Not all calls to
Checkable::NotificationReasonApplies()
needGetStateBeforeSuppression()
to be checked. In fact, for one caller,FireSuppressedNotifications()
inlib/notification/notificationcomponent.cpp
, the state before suppression may not even be initialized properly, so that the default value of OK is used which can lead to incorrect return values. Note the difference between suppressions happening on the level of theCheckable
object level and theNotification
object level. Only the first sets the state before suppression in theCheckable
object, but so far, also the latter used that value incorrectly.This commit moves the check of
GetStateBeforeSuppression()
fromCheckable::NotificationReasonApplies()
to the one place where it's actually relevant:Checkable::FireSuppressedNotifications()
. This made the existing call toNotificationReasonApplies()
unneccessary as it would always return true: thetype
argument is computed based on the current check result, so there's no need to check it against the current check result.