]> granicus.if.org Git - icinga2/commitdiff
DB IDO: Fix duplicate entries in scheduleddowntime table
authorMichael Friedrich <michael.friedrich@netways.de>
Thu, 12 Feb 2015 12:18:33 +0000 (13:18 +0100)
committerMichael Friedrich <michael.friedrich@netways.de>
Thu, 12 Feb 2015 12:19:27 +0000 (13:19 +0100)
fixes #8425

lib/db_ido/dbevents.cpp

index 3dc6c7a6f7433bb0740db2602e1613244d774d3f..0fbc748354d46b96ca223d72f0ddfe52cb3ec4de 100644 (file)
@@ -475,6 +475,11 @@ void DbEvents::AddDowntimes(const Checkable::Ptr& checkable)
 
 void DbEvents::AddDowntime(const Checkable::Ptr& checkable, const Downtime::Ptr& downtime)
 {
+       /*
+        * make sure to delete any old downtime to avoid multiple inserts from
+        * configured ScheduledDowntime dumps and CreateNextDowntime() calls
+        */
+       RemoveDowntime(checkable, downtime);
        AddDowntimeInternal(checkable, downtime, false);
 }