mirror of
https://github.com/Icinga/icinga2.git
synced 2025-07-28 16:14:09 +02:00
IcingaDB: Always send dependencies state HSET updates to Redis
This commit is contained in:
parent
21cd5e00fa
commit
da637c3741
@ -1386,6 +1386,7 @@ void IcingaDB::UpdateDependenciesState(const Checkable::Ptr& checkable, const De
|
||||
streamStates.emplace_back(std::move(xAdd));
|
||||
});
|
||||
|
||||
std::map<String, RedisConnection::Query> hMSets;
|
||||
for (auto& dependencyGroup : dependencyGroups) {
|
||||
bool isRedundancyGroup(dependencyGroup->IsRedundancyGroup());
|
||||
if (isRedundancyGroup && dependencyGroup->GetIcingaDBIdentifier().IsEmpty()) {
|
||||
@ -1413,6 +1414,7 @@ void IcingaDB::UpdateDependenciesState(const Checkable::Ptr& checkable, const De
|
||||
}
|
||||
|
||||
addDependencyStateToStream(m_PrefixConfigObject + "dependency:edge:state", stateAttrs);
|
||||
AddDataToHmSets(hMSets, RedisKey::DependencyEdgeState, stateAttrs->Get("id"), stateAttrs);
|
||||
}
|
||||
|
||||
if (isRedundancyGroup) {
|
||||
@ -1425,10 +1427,19 @@ void IcingaDB::UpdateDependenciesState(const Checkable::Ptr& checkable, const De
|
||||
|
||||
addDependencyStateToStream(m_PrefixConfigObject + "redundancygroup:state", stateAttrs);
|
||||
addDependencyStateToStream(m_PrefixConfigObject + "dependency:edge:state", sharedGroupState);
|
||||
AddDataToHmSets(hMSets, RedisKey::RedundancyGroupState, dependencyGroup->GetIcingaDBIdentifier(), stateAttrs);
|
||||
AddDataToHmSets(hMSets, RedisKey::DependencyEdgeState, dependencyGroup->GetIcingaDBIdentifier(), sharedGroupState);
|
||||
}
|
||||
}
|
||||
|
||||
if (!streamStates.empty()) {
|
||||
RedisConnection::Queries queries;
|
||||
for (auto& [redisKey, query] : hMSets) {
|
||||
query.insert(query.begin(), {"HSET", redisKey});
|
||||
queries.emplace_back(std::move(query));
|
||||
}
|
||||
|
||||
m_Rcon->FireAndForgetQueries(std::move(queries), Prio::RuntimeStateSync);
|
||||
m_Rcon->FireAndForgetQueries(std::move(streamStates), Prio::RuntimeStateStream, {0, 1});
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user