Skip to content

Commit

Permalink
Merge pull request #6820 from Icinga/bugfix/scheduled-downtime-ha-dup…
Browse files Browse the repository at this point in the history
…licates

Only create downtimes from non-paused ScheduledDowntime objects in HA enabled cluster zones
  • Loading branch information
Michael Friedrich authored Dec 5, 2018
2 parents 0ad27d5 + fd9b2de commit 0cc559b
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions lib/icinga/scheduleddowntime.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,13 +95,14 @@ void ScheduledDowntime::Start(bool runtimeCreated)
l_Timer->Start();
});

Utility::QueueAsyncCallback(std::bind(&ScheduledDowntime::CreateNextDowntime, this));
if (!IsPaused())
Utility::QueueAsyncCallback(std::bind(&ScheduledDowntime::CreateNextDowntime, this));
}

void ScheduledDowntime::TimerProc()
{
for (const ScheduledDowntime::Ptr& sd : ConfigType::GetObjectsByType<ScheduledDowntime>()) {
if (sd->IsActive())
if (sd->IsActive() && !sd->IsPaused())
sd->CreateNextDowntime();
}
}
Expand Down Expand Up @@ -235,6 +236,13 @@ std::pair<double, double> ScheduledDowntime::FindNextSegment()

void ScheduledDowntime::CreateNextDowntime()
{
/* HA enabled zones. */
if (IsActive() && IsPaused()) {
Log(LogNotice, "Checkable")
<< "Skipping downtime creation for HA-paused Scheduled Downtime object '" << GetName() << "'";
return;
}

double minEnd = 0;

for (const Downtime::Ptr& downtime : GetCheckable()->GetDowntimes()) {
Expand Down

0 comments on commit 0cc559b

Please sign in to comment.