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