]> granicus.if.org Git - icinga2/commitdiff
Add missing DowntimesExpireTimer.
authorMichael Friedrich <michael.friedrich@netways.de>
Tue, 17 Sep 2013 18:11:29 +0000 (20:11 +0200)
committerMichael Friedrich <michael.friedrich@netways.de>
Tue, 17 Sep 2013 18:11:29 +0000 (20:11 +0200)
now the expired downtimes will get deleted every 60 seconds.

fixes #4711

lib/icinga/service-downtime.cpp
lib/icinga/service.cpp
lib/icinga/service.h

index 1767f6ff2f05d6c1e67191b09ec4de30e47292e5..a91aa7807c48ebd0c8e428515934417871aa345f 100644 (file)
@@ -289,6 +289,16 @@ bool Service::IsDowntimeExpired(const Dictionary::Ptr& downtime)
        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)
 {
        Log(LogDebug, "icinga", "Updating Service downtimes cache.");
index d12bef569650d94f5edc9a34cb27e41db8cdb406..34d9a2816bf848ca4e678143b3ad638f266b8418 100644 (file)
@@ -51,6 +51,8 @@ void Service::Start(void)
 
        AddDowntimesToCache();
        AddCommentsToCache();
+
+       StartDowntimesExpiredTimer();
 }
 
 void Service::OnConfigLoaded(void)
index aeed0693f621ef6588d63511a3b60e063f49ca57..14b8ffb348bb89e443a235162c482c3e7a6024a9 100644 (file)
@@ -275,6 +275,8 @@ public:
        static bool IsDowntimeTriggered(const Dictionary::Ptr& downtime);
        static bool IsDowntimeExpired(const Dictionary::Ptr& downtime);
 
+       void StartDowntimesExpiredTimer(void);
+
        bool IsInDowntime(void) const;
        bool IsAcknowledged(void);