mirror of https://github.com/Icinga/icinga2.git
parent
8f53835c11
commit
a17419e8c2
|
@ -58,14 +58,15 @@ bool ApiListener::UpdateConfigDir(const Dictionary::Ptr& oldConfig, const Dictio
|
||||||
{
|
{
|
||||||
bool configChange = false;
|
bool configChange = false;
|
||||||
|
|
||||||
if (oldConfig->Contains(".timestamp") && newConfig->Contains(".timestamp")) {
|
if (!(oldConfig->Contains(".timestamp") && newConfig->Contains(".timestamp")))
|
||||||
double oldTS = Convert::ToDouble(oldConfig->Get(".timestamp"));
|
return false;
|
||||||
double newTS = Convert::ToDouble(newConfig->Get(".timestamp"));
|
|
||||||
|
|
||||||
/* skip update if our config is newer */
|
double oldTimestamp = Convert::ToDouble(oldConfig->Get(".timestamp"));
|
||||||
if (oldTS <= newTS)
|
double newTimestamp = Convert::ToDouble(newConfig->Get(".timestamp"));
|
||||||
return false;
|
|
||||||
}
|
/* skip update if our config is newer */
|
||||||
|
if (oldTimestamp <= newTimestamp)
|
||||||
|
return false;
|
||||||
|
|
||||||
{
|
{
|
||||||
ObjectLock olock(newConfig);
|
ObjectLock olock(newConfig);
|
||||||
|
@ -99,7 +100,7 @@ bool ApiListener::UpdateConfigDir(const Dictionary::Ptr& oldConfig, const Dictio
|
||||||
String tsPath = configDir + "/.timestamp";
|
String tsPath = configDir + "/.timestamp";
|
||||||
if (!Utility::PathExists(tsPath)) {
|
if (!Utility::PathExists(tsPath)) {
|
||||||
std::ofstream fp(tsPath.CStr(), std::ofstream::out | std::ostream::trunc);
|
std::ofstream fp(tsPath.CStr(), std::ofstream::out | std::ostream::trunc);
|
||||||
fp << std::fixed << Utility::GetTime();
|
fp << std::fixed << newTimestamp;
|
||||||
fp.close();
|
fp.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue