Skip to content

Commit 4fb27a4

Browse files
authored
Merge pull request #8863 from Icinga/bugfix/harden-scheduled-downtimes-212
ScheduledDowntime::TimerProc(): Catch exceptions to make sure other downtimes are still created
2 parents a79f4f9 + 7e0eab3 commit 4fb27a4

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

lib/icinga/scheduleddowntime.cpp

+9-2
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,15 @@ void ScheduledDowntime::Start(bool runtimeCreated)
8787
void ScheduledDowntime::TimerProc()
8888
{
8989
for (const ScheduledDowntime::Ptr& sd : ConfigType::GetObjectsByType<ScheduledDowntime>()) {
90-
if (sd->IsActive() && !sd->IsPaused())
91-
sd->CreateNextDowntime();
90+
if (sd->IsActive() && !sd->IsPaused()) {
91+
try {
92+
sd->CreateNextDowntime();
93+
} catch (const std::exception& ex) {
94+
Log(LogCritical, "ScheduledDowntime")
95+
<< "Exception occurred during creation of next downtime for scheduled downtime '"
96+
<< sd->GetName() << "': " << DiagnosticInformation(ex, false);
97+
}
98+
}
9299
}
93100
}
94101

0 commit comments

Comments
 (0)