From: Michael Friedrich Date: Mon, 25 Jan 2016 14:21:25 +0000 (+0100) Subject: Fix cluster config timestamp again X-Git-Tag: v2.5.0~593 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d412a9055d2e55b2291bdcd31643ed5e2d955a8f;p=icinga2 Fix cluster config timestamp again refs #11014 --- diff --git a/lib/remote/apilistener-filesync.cpp b/lib/remote/apilistener-filesync.cpp index e8720b6c6..a5744237c 100644 --- a/lib/remote/apilistener-filesync.cpp +++ b/lib/remote/apilistener-filesync.cpp @@ -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; {