Skip to content

Commit

Permalink
ApiListener: Sync runtime configs in order
Browse files Browse the repository at this point in the history
  • Loading branch information
yhabteab committed Sep 26, 2024
1 parent 6b6f135 commit 6effb4a
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions lib/remote/apilistener-configsync.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -454,13 +454,17 @@ void ApiListener::SendRuntimeConfigObjects(const JsonRpcConnection::Ptr& aclient
Log(LogInformation, "ApiListener")
<< "Syncing runtime objects to endpoint '" << endpoint->GetName() << "'.";

for (const Type::Ptr& type : Type::GetAllTypes()) {
auto *dtype = dynamic_cast<ConfigType *>(type.get());

if (!dtype)
// All objects must be synced sorted by their load dependency. Otherwise, downtimes and/or comments might get
// synced before their respective Checkables, which will result in comments and downtimes being ignored by the
// other endpoint since it does not yet know about their checkables. Given that the runtime config updates event
// does not trigger a reload on the remote endpoint, these objects won't be synced again until the next reload.
for (const Type::Ptr& type : Type::GetConfigTypesSortedByLoadDependencies()) {
auto *ctype = dynamic_cast<ConfigType *>(type.get());

if (!ctype)
continue;

for (const ConfigObject::Ptr& object : dtype->GetObjects()) {
for (const ConfigObject::Ptr& object : ctype->GetObjects()) {
/* don't sync objects for non-matching parent-child zones */
if (!azone->CanAccessObject(object))
continue;
Expand Down

0 comments on commit 6effb4a

Please sign in to comment.