refactor account_data.changes_since to stream

Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
Jason Volk 2024-11-19 03:08:09 +00:00
parent fd4c447a2d
commit 5da42fb859
4 changed files with 39 additions and 61 deletions

View file

@ -136,10 +136,9 @@ pub(crate) async fn sync_events_v4_route(
account_data.global = services
.account_data
.changes_since(None, sender_user, globalsince)
.await?
.into_iter()
.filter_map(|e| extract_variant!(e, AnyRawAccountDataEvent::Global))
.collect();
.ready_filter_map(|e| extract_variant!(e, AnyRawAccountDataEvent::Global))
.collect()
.await;
if let Some(rooms) = body.extensions.account_data.rooms {
for room in rooms {
@ -148,10 +147,9 @@ pub(crate) async fn sync_events_v4_route(
services
.account_data
.changes_since(Some(&room), sender_user, globalsince)
.await?
.into_iter()
.filter_map(|e| extract_variant!(e, AnyRawAccountDataEvent::Room))
.collect(),
.ready_filter_map(|e| extract_variant!(e, AnyRawAccountDataEvent::Room))
.collect()
.await,
);
}
}
@ -487,10 +485,9 @@ pub(crate) async fn sync_events_v4_route(
services
.account_data
.changes_since(Some(room_id), sender_user, *roomsince)
.await?
.into_iter()
.filter_map(|e| extract_variant!(e, AnyRawAccountDataEvent::Room))
.collect(),
.ready_filter_map(|e| extract_variant!(e, AnyRawAccountDataEvent::Room))
.collect()
.await,
);
let vector: Vec<_> = services