perf: Remove huge clone and tackle TODOs

This commit is contained in:
timedout authored and Jade Ellis committed 2026-06-27 20:21:35 +01:00
1 parent 00a9ef1c06
commit 3b8788d5d2
2 files changed
+12 -14

No files matched your search

@@ -5,7 +5,7 @@ use conduwuit::{
utils::{BoolExt, IterStream, stream::BroadbandExt},
};
use futures::StreamExt;
use ruma::{RoomId, ServerName};
use ruma::{CanonicalJsonObject, OwnedEventId, RoomId, ServerName};
use crate::rooms::event_handler::build_local_dag;
@@ -78,7 +78,9 @@ impl super::Service {
let to_persist = if mapped.len() <= 1 {
mapped.keys().map(ToOwned::to_owned).collect()
} else {
build_local_dag(&mapped).await?
let refmap: HashMap<OwnedEventId, &CanonicalJsonObject> =
mapped.iter().map(|(id, data)| (id.clone(), data)).collect();
build_local_dag(&refmap).await?
};
let job_start = Instant::now();