mirror of https://github.com/Icinga/icinga2.git
ApiListener::ConfigUpdateHandler(): block as less as possible
refs #7742
This commit is contained in:
parent
71cefb9ea4
commit
dc3062a9b0
|
@ -13,6 +13,7 @@
|
||||||
#include "base/utility.hpp"
|
#include "base/utility.hpp"
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <iomanip>
|
#include <iomanip>
|
||||||
|
#include <thread>
|
||||||
|
|
||||||
using namespace icinga;
|
using namespace icinga;
|
||||||
|
|
||||||
|
@ -310,6 +311,12 @@ Value ApiListener::ConfigUpdateHandler(const MessageOrigin::Ptr& origin, const D
|
||||||
return Empty;
|
return Empty;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::thread([origin, params]() { HandleConfigUpdate(origin, params); }).detach();
|
||||||
|
return Empty;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ApiListener::HandleConfigUpdate(const MessageOrigin::Ptr& origin, const Dictionary::Ptr& params)
|
||||||
|
{
|
||||||
/* Only one transaction is allowed, concurrent message handlers need to wait.
|
/* Only one transaction is allowed, concurrent message handlers need to wait.
|
||||||
* This affects two parent endpoints sending the config in the same moment.
|
* This affects two parent endpoints sending the config in the same moment.
|
||||||
*/
|
*/
|
||||||
|
@ -527,8 +534,6 @@ Value ApiListener::ConfigUpdateHandler(const MessageOrigin::Ptr& origin, const D
|
||||||
<< "Received configuration updates (" << count << ") from endpoint '" << fromEndpointName
|
<< "Received configuration updates (" << count << ") from endpoint '" << fromEndpointName
|
||||||
<< "' are equal to production, skipping validation and reload.";
|
<< "' are equal to production, skipping validation and reload.";
|
||||||
}
|
}
|
||||||
|
|
||||||
return Empty;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -85,6 +85,7 @@ public:
|
||||||
|
|
||||||
/* filesync */
|
/* filesync */
|
||||||
static Value ConfigUpdateHandler(const MessageOrigin::Ptr& origin, const Dictionary::Ptr& params);
|
static Value ConfigUpdateHandler(const MessageOrigin::Ptr& origin, const Dictionary::Ptr& params);
|
||||||
|
static void HandleConfigUpdate(const MessageOrigin::Ptr& origin, const Dictionary::Ptr& params);
|
||||||
|
|
||||||
/* configsync */
|
/* configsync */
|
||||||
static void ConfigUpdateObjectHandler(const ConfigObject::Ptr& object, const Value& cookie);
|
static void ConfigUpdateObjectHandler(const ConfigObject::Ptr& object, const Value& cookie);
|
||||||
|
|
Loading…
Reference in New Issue