IcingaDB::AddObjectDataToRuntimeUpdates(): Copy data before modifying

This commit is contained in:
Noah Hilverling 2021-10-28 12:53:15 +02:00
parent 10bde2075a
commit 7a0796061a
1 changed files with 5 additions and 4 deletions

View File

@ -1160,10 +1160,11 @@ void IcingaDB::SendConfigUpdate(const ConfigObject::Ptr& object, bool runtimeUpd
void IcingaDB::AddObjectDataToRuntimeUpdates(std::vector<Dictionary::Ptr>& runtimeUpdates, const String& objectKey,
const String& redisKey, const Dictionary::Ptr& data)
{
data->Set("id", objectKey);
data->Set("redis_key", redisKey);
data->Set("runtime_type", "upsert");
runtimeUpdates.emplace_back(data);
Dictionary::Ptr dataClone = data->ShallowClone();
dataClone->Set("id", objectKey);
dataClone->Set("redis_key", redisKey);
dataClone->Set("runtime_type", "upsert");
runtimeUpdates.emplace_back(dataClone);
}
// Takes object and collects IcingaDB relevant attributes and computes checksums. Returns whether the object is relevant