From f28b9fb7f3c6f2aa834de3b5d3a6564d14e133fd Mon Sep 17 00:00:00 2001 From: "Alexander A. Klimov" Date: Wed, 19 May 2021 16:10:57 +0200 Subject: [PATCH] ScheduledDowntime: ignore not related Downtimes while creating Downtimes --- lib/icinga/scheduleddowntime.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/icinga/scheduleddowntime.cpp b/lib/icinga/scheduleddowntime.cpp index 70e1811f2..522ca3571 100644 --- a/lib/icinga/scheduleddowntime.cpp +++ b/lib/icinga/scheduleddowntime.cpp @@ -231,12 +231,14 @@ void ScheduledDowntime::CreateNextDowntime() double minEnd = 0; for (const Downtime::Ptr& downtime : GetCheckable()->GetDowntimes()) { + if (downtime->GetScheduledBy() != GetName()) + continue; + double end = downtime->GetEndTime(); if (end > minEnd) minEnd = end; - if (downtime->GetScheduledBy() != GetName() || - downtime->GetStartTime() < Utility::GetTime()) + if (downtime->GetStartTime() < Utility::GetTime()) continue; /* We've found a downtime that is owned by us and that hasn't started yet - we're done. */