flatten auth chain iterations
Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
parent
eb7d893c86
commit
50acfe7832
8 changed files with 90 additions and 111 deletions
|
@ -44,18 +44,11 @@ pub async fn resolve_state(
|
|||
let auth_chain_sets: Vec<HashSet<OwnedEventId>> = fork_states
|
||||
.iter()
|
||||
.try_stream()
|
||||
.wide_and_then(|state| async move {
|
||||
let starting_events = state.values().map(Borrow::borrow);
|
||||
|
||||
let auth_chain = self
|
||||
.services
|
||||
.wide_and_then(|state| {
|
||||
self.services
|
||||
.auth_chain
|
||||
.get_event_ids(room_id, starting_events)
|
||||
.await?
|
||||
.into_iter()
|
||||
.collect();
|
||||
|
||||
Ok(auth_chain)
|
||||
.event_ids_iter(room_id, state.values().map(Borrow::borrow))
|
||||
.try_collect()
|
||||
})
|
||||
.try_collect()
|
||||
.await?;
|
||||
|
|
|
@ -10,7 +10,7 @@ use conduwuit::{
|
|||
utils::stream::{BroadbandExt, IterStream},
|
||||
PduEvent, Result,
|
||||
};
|
||||
use futures::{FutureExt, StreamExt};
|
||||
use futures::{FutureExt, StreamExt, TryStreamExt};
|
||||
use ruma::{state_res::StateMap, OwnedEventId, RoomId, RoomVersionId};
|
||||
|
||||
// TODO: if we know the prev_events of the incoming event we can avoid the
|
||||
|
@ -140,10 +140,9 @@ pub(super) async fn state_at_incoming_resolved(
|
|||
let auth_chain: HashSet<OwnedEventId> = self
|
||||
.services
|
||||
.auth_chain
|
||||
.get_event_ids(room_id, starting_events.into_iter())
|
||||
.await?
|
||||
.into_iter()
|
||||
.collect();
|
||||
.event_ids_iter(room_id, starting_events.into_iter())
|
||||
.try_collect()
|
||||
.await?;
|
||||
|
||||
auth_chain_sets.push(auth_chain);
|
||||
fork_states.push(state);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue