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 <fstream>
|
||||
#include <iomanip>
|
||||
#include <thread>
|
||||
|
||||
using namespace icinga;
|
||||
|
||||
|
@ -310,6 +311,12 @@ Value ApiListener::ConfigUpdateHandler(const MessageOrigin::Ptr& origin, const D
|
|||
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.
|
||||
* 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
|
||||
<< "' are equal to production, skipping validation and reload.";
|
||||
}
|
||||
|
||||
return Empty;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -85,6 +85,7 @@ public:
|
|||
|
||||
/* filesync */
|
||||
static Value ConfigUpdateHandler(const MessageOrigin::Ptr& origin, const Dictionary::Ptr& params);
|
||||
static void HandleConfigUpdate(const MessageOrigin::Ptr& origin, const Dictionary::Ptr& params);
|
||||
|
||||
/* configsync */
|
||||
static void ConfigUpdateObjectHandler(const ConfigObject::Ptr& object, const Value& cookie);
|
||||
|
|
Loading…
Reference in New Issue