perf: Fetch auth chain events in parallel

This commit is contained in:
timedout committed 2026-10-16 18:32:38 +01:00
1 parent 17ddd3966d
commit b0a5caf576
1 file changed
+7 -2
+7 -2
View File
@@ -1,7 +1,10 @@
use std::{borrow::Borrow, iter::once};
use axum::extract::State;
use conduwuit::{Err, Event, Result, info, utils::stream::ReadyExt};
use conduwuit::{
Err, Event, Result, info,
utils::stream::{BroadbandExt, ReadyExt},
};
use futures::StreamExt;
use ruma::api::federation::authorization::get_event_authorization;
@@ -64,7 +67,9 @@ pub(crate) async fn get_event_authorization_route(
.auth_chain
.event_ids_iter(&body.room_id, once(body.event_id.borrow()))
.ready_filter_map(Result::ok)
.filter_map(|id| async move { services.rooms.timeline.get_pdu_json(&id).await.ok() })
.broad_filter_map(
|id| async move { services.rooms.timeline.get_pdu_json(&id).await.ok() },
)
.then(|pdu| services.sending.convert_to_outgoing_federation_event(pdu))
.collect()
.await;