Add missing DowntimesExpireTimer.

now the expired downtimes will get deleted every 60 seconds.

fixes #4711
This commit is contained in:
Michael Friedrich 2013-09-17 20:11:29 +02:00
parent 9a21af719d
commit 46659e7551
3 changed files with 14 additions and 0 deletions

View File

@ -289,6 +289,16 @@ bool Service::IsDowntimeExpired(const Dictionary::Ptr& downtime)
return (downtime->Get("end_time") < Utility::GetTime()); return (downtime->Get("end_time") < Utility::GetTime());
} }
void Service::StartDowntimesExpiredTimer(void)
{
if (!l_DowntimesExpireTimer) {
l_DowntimesExpireTimer = boost::make_shared<Timer>();
l_DowntimesExpireTimer->SetInterval(60);
l_DowntimesExpireTimer->OnTimerExpired.connect(boost::bind(&Service::DowntimesExpireTimerHandler));
l_DowntimesExpireTimer->Start();
}
}
void Service::AddDowntimesToCache(void) void Service::AddDowntimesToCache(void)
{ {
Log(LogDebug, "icinga", "Updating Service downtimes cache."); Log(LogDebug, "icinga", "Updating Service downtimes cache.");

View File

@ -51,6 +51,8 @@ void Service::Start(void)
AddDowntimesToCache(); AddDowntimesToCache();
AddCommentsToCache(); AddCommentsToCache();
StartDowntimesExpiredTimer();
} }
void Service::OnConfigLoaded(void) void Service::OnConfigLoaded(void)

View File

@ -275,6 +275,8 @@ public:
static bool IsDowntimeTriggered(const Dictionary::Ptr& downtime); static bool IsDowntimeTriggered(const Dictionary::Ptr& downtime);
static bool IsDowntimeExpired(const Dictionary::Ptr& downtime); static bool IsDowntimeExpired(const Dictionary::Ptr& downtime);
void StartDowntimesExpiredTimer(void);
bool IsInDowntime(void) const; bool IsInDowntime(void) const;
bool IsAcknowledged(void); bool IsAcknowledged(void);