]> granicus.if.org Git - icinga2/commitdiff
Fix cluster config timestamp again
authorMichael Friedrich <michael.friedrich@netways.de>
Mon, 25 Jan 2016 14:21:25 +0000 (15:21 +0100)
committerGunnar Beutner <gunnar@beutner.name>
Tue, 23 Feb 2016 08:31:51 +0000 (09:31 +0100)
refs #11014

lib/remote/apilistener-filesync.cpp

index 616bb3e663aa1ac56a4e13879dc9fd61c4086d4f..0b6d1dd169966d4d25a282e7481fc5d707d4edf4 100644 (file)
@@ -58,14 +58,22 @@ bool ApiListener::UpdateConfigDir(const Dictionary::Ptr& oldConfig, const Dictio
 {
        bool configChange = false;
 
-       if (!(oldConfig->Contains(".timestamp") && newConfig->Contains(".timestamp")))
-               return false;
+       double oldTimestamp;
+
+       if (!oldConfig->Contains(".timestamp"))
+               oldTimestamp = 0;
+       else
+               oldTimestamp = oldConfig->Get(".timestamp");
+
+       double newTimestamp;
 
-       double oldTimestamp = Convert::ToDouble(oldConfig->Get(".timestamp"));
-       double newTimestamp = Convert::ToDouble(newConfig->Get(".timestamp"));
+       if (!newConfig->Contains(".timestamp"))
+               newTimestamp = Utility::GetTime();
+       else
+               newTimestamp = newConfig->Get(".timestamp");
 
        /* skip update if our config is newer */
-       if (oldTimestamp <= newTimestamp)
+       if (oldTimestamp >= newTimestamp)
                return false;
 
        {