mirror of https://github.com/Icinga/icinga2.git
ApiListener: Process cluster config updates sequentially
This commit is contained in:
parent
1a55b68541
commit
433e2de13a
|
@ -8,6 +8,7 @@
|
||||||
#include "base/json.hpp"
|
#include "base/json.hpp"
|
||||||
#include "base/convert.hpp"
|
#include "base/convert.hpp"
|
||||||
#include "config/vmops.hpp"
|
#include "config/vmops.hpp"
|
||||||
|
#include "remote/configobjectslock.hpp"
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
|
|
||||||
using namespace icinga;
|
using namespace icinga;
|
||||||
|
@ -104,6 +105,11 @@ Value ApiListener::ConfigUpdateObjectAPIHandler(const MessageOrigin::Ptr& origin
|
||||||
return Empty;
|
return Empty;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Wait for the object name to become available for processing and block it immediately.
|
||||||
|
// Doing so guarantees that only one (create/update/delete) cluster event or API request of a
|
||||||
|
// given object is being processed at any given time.
|
||||||
|
ObjectNameLock objectNameLock(ptype, objName);
|
||||||
|
|
||||||
ConfigObject::Ptr object = ctype->GetObject(objName);
|
ConfigObject::Ptr object = ctype->GetObject(objName);
|
||||||
|
|
||||||
String config = params->Get("config");
|
String config = params->Get("config");
|
||||||
|
@ -258,6 +264,11 @@ Value ApiListener::ConfigDeleteObjectAPIHandler(const MessageOrigin::Ptr& origin
|
||||||
return Empty;
|
return Empty;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Wait for the object name to become available for processing and block it immediately.
|
||||||
|
// Doing so guarantees that only one (create/update/delete) cluster event or API request of a
|
||||||
|
// given object is being processed at any given time.
|
||||||
|
ObjectNameLock objectNameLock(ptype, objName);
|
||||||
|
|
||||||
ConfigObject::Ptr object = ctype->GetObject(objName);
|
ConfigObject::Ptr object = ctype->GetObject(objName);
|
||||||
|
|
||||||
if (!object) {
|
if (!object) {
|
||||||
|
|
Loading…
Reference in New Issue