mirror of
https://github.com/Icinga/icinga2.git
synced 2025-04-08 17:05:25 +02:00
ApiListener: Process cluster config updates sequentially
This commit is contained in:
parent
3d5e0fef69
commit
42891028ca
@ -8,6 +8,7 @@
|
||||
#include "base/json.hpp"
|
||||
#include "base/convert.hpp"
|
||||
#include "config/vmops.hpp"
|
||||
#include "remote/configobjectslock.hpp"
|
||||
#include <fstream>
|
||||
|
||||
using namespace icinga;
|
||||
@ -104,6 +105,11 @@ Value ApiListener::ConfigUpdateObjectAPIHandler(const MessageOrigin::Ptr& origin
|
||||
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);
|
||||
|
||||
String config = params->Get("config");
|
||||
@ -258,6 +264,11 @@ Value ApiListener::ConfigDeleteObjectAPIHandler(const MessageOrigin::Ptr& origin
|
||||
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);
|
||||
|
||||
if (!object) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user