Take host state into account when sending suppressed notifications

Checkable::FireSuppressedNotifications() compares the time of the current
checkable with the last recovery time of parents to avoid notification right
after a parent recovered and before the current checkable was checked.

This commit makes this check also include to host if the checkable is a
service.  This makes the behavior consistent with the documentation that states
there is an implicit dependency on the host (which isn't realized as implicitly
generating a Dependency object unfortunately).
This commit is contained in:
Julian Brost 2022-04-19 15:54:51 +02:00
parent 9644effe86
commit 51cd7e7b0b
1 changed files with 11 additions and 0 deletions

View File

@ -155,6 +155,17 @@ void Checkable::FireSuppressedNotifications()
}
auto threshold (cr->GetExecutionStart());
Host::Ptr host;
Service::Ptr service;
tie(host, service) = GetHostService(this);
if (service) {
ObjectLock oLock (host);
if (!host->GetProblem() && host->GetLastStateChange() >= threshold) {
return true;
}
}
for (auto& dep : GetDependencies()) {
auto parent (dep->GetParent());