From f48ad574d7616da0e8000e8191abbaa8b1bb2808 Mon Sep 17 00:00:00 2001 From: Noah Hilverling Date: Mon, 21 Jun 2021 16:23:06 +0200 Subject: [PATCH] ScheduledDowntime::TimerProc(): Catch exceptions to make sure other downtimes are still created --- lib/icinga/scheduleddowntime.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/lib/icinga/scheduleddowntime.cpp b/lib/icinga/scheduleddowntime.cpp index 522ca3571..ae38ca9b6 100644 --- a/lib/icinga/scheduleddowntime.cpp +++ b/lib/icinga/scheduleddowntime.cpp @@ -87,8 +87,15 @@ void ScheduledDowntime::Start(bool runtimeCreated) void ScheduledDowntime::TimerProc() { for (const ScheduledDowntime::Ptr& sd : ConfigType::GetObjectsByType()) { - if (sd->IsActive() && !sd->IsPaused()) - sd->CreateNextDowntime(); + if (sd->IsActive() && !sd->IsPaused()) { + try { + sd->CreateNextDowntime(); + } catch (const std::exception& ex) { + Log(LogCritical, "ScheduledDowntime") + << "Exception occurred during creation of next downtime for scheduled downtime '" + << sd->GetName() << "': " << DiagnosticInformation(ex, false); + } + } } }