diff --git a/lib/remote/apilistener-configsync.cpp b/lib/remote/apilistener-configsync.cpp index a12db0bca73..253eddc5371 100644 --- a/lib/remote/apilistener-configsync.cpp +++ b/lib/remote/apilistener-configsync.cpp @@ -443,7 +443,16 @@ void ApiListener::SendRuntimeConfigObjects(const JsonRpcConnection::Ptr& aclient Log(LogInformation, "ApiListener") << "Syncing runtime objects to endpoint '" << endpoint->GetName() << "'."; - for (const Type::Ptr& type : Type::GetAllTypes()) { + // Sync all objects in priority descending order, otherwise downtimes, comments... might be synced before their + // respective checkables are synchronized, which would result in comments/downtimes being ignored by the other + // endpoint since it does not yet know about their checkables. Since the runtime config updates event doesn't + // trigger a reload on the remote endpoint, these objects won't be synced again til the next reload. + std::vector types = Type::GetAllTypes(); + std::sort(types.begin(), types.end(), [](const Type::Ptr& a, const Type::Ptr& b) { + return a->GetActivationPriority() > b->GetActivationPriority(); + }); + + for (const Type::Ptr& type : types) { auto *dtype = dynamic_cast(type.get()); if (!dtype)