]> 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)
committerMichael Friedrich <michael.friedrich@netways.de>
Mon, 25 Jan 2016 14:49:32 +0000 (15:49 +0100)
refs #11014

lib/remote/apilistener-filesync.cpp

index e8720b6c63fa6fcf18621250c22461a9c44db2d8..a5744237c1c3a9aad414cdf40552f3c2b751d1e2 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;
 
        {