mirror of
https://github.com/Icinga/icinga2.git
synced 2025-09-21 16:57:58 +02:00
ScheduledDowntime: consider also newly added earlier ranges
This commit is contained in:
parent
d17b4ecc4b
commit
cb30f0357b
@ -13,6 +13,7 @@
|
|||||||
#include "base/logger.hpp"
|
#include "base/logger.hpp"
|
||||||
#include "base/exception.hpp"
|
#include "base/exception.hpp"
|
||||||
#include <boost/thread/once.hpp>
|
#include <boost/thread/once.hpp>
|
||||||
|
#include <set>
|
||||||
|
|
||||||
using namespace icinga;
|
using namespace icinga;
|
||||||
|
|
||||||
@ -228,28 +229,22 @@ void ScheduledDowntime::CreateNextDowntime()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
double minEnd = 0;
|
std::set<double> ends;
|
||||||
|
|
||||||
for (const Downtime::Ptr& downtime : GetCheckable()->GetDowntimes()) {
|
for (const Downtime::Ptr& downtime : GetCheckable()->GetDowntimes()) {
|
||||||
double end = downtime->GetEndTime();
|
if (downtime->GetScheduledBy() != GetName())
|
||||||
if (end > minEnd)
|
|
||||||
minEnd = end;
|
|
||||||
|
|
||||||
if (downtime->GetScheduledBy() != GetName() ||
|
|
||||||
downtime->GetStartTime() < Utility::GetTime())
|
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
/* We've found a downtime that is owned by us and that hasn't started yet - we're done. */
|
ends.emplace(downtime->GetEndTime());
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Log(LogDebug, "ScheduledDowntime")
|
Log(LogDebug, "ScheduledDowntime")
|
||||||
<< "Creating new Downtime for ScheduledDowntime \"" << GetName() << "\"";
|
<< "Creating new Downtime for ScheduledDowntime \"" << GetName() << "\"";
|
||||||
|
|
||||||
std::pair<double, double> segment = FindRunningSegment(minEnd);
|
std::pair<double, double> segment = FindRunningSegment();
|
||||||
if (segment.first == 0 && segment.second == 0) {
|
if (segment.first == 0 && segment.second == 0 || ends.find(segment.second) != ends.end()) {
|
||||||
segment = FindNextSegment();
|
segment = FindNextSegment();
|
||||||
if (segment.first == 0 && segment.second == 0)
|
if (segment.first == 0 && segment.second == 0 || ends.find(segment.second) != ends.end())
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user