diff --git a/kuksa_databroker/databroker/src/grpc/kuksa_val_v1/val.rs b/kuksa_databroker/databroker/src/grpc/kuksa_val_v1/val.rs index 7945acf8..7b9e0fe4 100644 --- a/kuksa_databroker/databroker/src/grpc/kuksa_val_v1/val.rs +++ b/kuksa_databroker/databroker/src/grpc/kuksa_val_v1/val.rs @@ -414,17 +414,12 @@ impl proto::val_server::Val for broker::DataBroker { .for_each_entry(|entry| { let entry_path = &entry.metadata().path; if regex.is_match(entry_path) { - let id = &entry.metadata().id; - match entries.get(id) { - Some(fields) => { - let joined_set: HashSet<_> = - fields.union(&fields_set).cloned().collect(); - entries.insert(*id, joined_set); - } - None => { - entries.insert(*id, fields_set.clone()); - } - } + entries + .entry(entry.metadata().id) + .and_modify(|existing_fields| { + existing_fields.extend(fields.clone()); + }) + .or_insert(fields.clone()); } }) .await;