fix: Use prepare_lazily_loaded_members for joined rooms

Also, don't take read receipts into consideration for lazy loading.
Synapse doesn't do this and they're making initial syncs very large.
This commit is contained in:
Ginger
2025-10-28 11:32:12 -04:00
parent 3e6571a2b8
commit 693e327004
2 changed files with 16 additions and 36 deletions
+13 -11
View File
@@ -430,8 +430,19 @@ async fn prepare_lazily_loaded_members(
) -> Option<MemberSet> {
let lazy_loading_context = &sync_context.lazy_loading_context(room_id);
// the user IDs of members whose membership needs to be sent to the client, if
// lazy-loading is enabled.
// reset lazy loading state on initial sync.
// do this even if lazy loading is disabled so future lazy loads
// will have the correct members.
if sync_context.since.is_none() {
services
.rooms
.lazy_loading
.reset(lazy_loading_context)
.await;
}
// filter the input members through `retain_lazy_members`, which
// contains the actual lazy loading logic.
let lazily_loaded_members =
OptionFuture::from(sync_context.lazy_loading_enabled().then(|| {
services
@@ -441,14 +452,5 @@ async fn prepare_lazily_loaded_members(
}))
.await;
// reset lazy loading state on initial sync
if sync_context.since.is_none() {
services
.rooms
.lazy_loading
.reset(lazy_loading_context)
.await;
}
lazily_loaded_members
}