Provide sync watch rooms as argument rather than assuming all joined rooms.

Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
Jason Volk
2025-10-06 09:49:11 +00:00
parent 6c724bbc2f
commit a6127fcd1a
3 changed files with 25 additions and 12 deletions

View File

@@ -163,10 +163,14 @@ pub(crate) async fn sync_events_route(
.expect("configuration must limit maximum timeout");
loop {
let watchers = services.sync.watch(sender_user, sender_device);
let next_batch = services.globals.wait_pending().await?;
let watch_rooms = services.state_cache.rooms_joined(sender_user);
let watchers = services
.sync
.watch(sender_user, sender_device, watch_rooms);
let next_batch = services.globals.wait_pending().await?;
debug_assert!(since <= next_batch, "next_batch is monotonic");
if since < next_batch || body.body.full_state {
let response = build_sync_events(&services, &body, since, next_batch).await?;
let empty = response.rooms.is_empty()