MCPcopy Create free account
hub / github.com/Icinga/icinga2 / SetupCleanupTimer

Method SetupCleanupTimer

lib/icinga/downtime.cpp:464–484  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

462}
463
464void Downtime::SetupCleanupTimer()
465{
466 if (!m_CleanupTimer) {
467 m_CleanupTimer = Timer::Create();
468
469 auto name (GetName());
470
471 m_CleanupTimer->OnTimerExpired.connect([name=std::move(name)](const Timer * const&) {
472 auto downtime (Downtime::GetByName(name));
473
474 if (downtime && downtime->IsExpired()) {
475 RemoveDowntime(name, false, DowntimeExpired);
476 }
477 });
478 }
479
480 auto triggerTime (GetTriggerTime());
481
482 m_CleanupTimer->Reschedule((GetFixed() || triggerTime <= 0 ? GetEndTime() : triggerTime + GetDuration()) + 0.1);
483 m_CleanupTimer->Start();
484}
485
486void Downtime::TriggerDowntime(double triggerTime)
487{

Callers

nothing calls this directly

Calls 3

RescheduleMethod · 0.80
IsExpiredMethod · 0.45
StartMethod · 0.45

Tested by

no test coverage detected