From 0d439188e8e0c5d2fbbebd7be7c86a626292ab49 Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Fri, 25 Jul 2025 12:03:40 +0000 Subject: [PATCH] Fix sequence windowing for sync v3 invite/leave/knock rooms. Signed-off-by: Jason Volk --- src/api/client/sync/v3.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/api/client/sync/v3.rs b/src/api/client/sync/v3.rs index e551a62d..d9257567 100644 --- a/src/api/client/sync/v3.rs +++ b/src/api/client/sync/v3.rs @@ -246,7 +246,7 @@ pub(crate) async fn build_sync_events( .ok(); // Invited before last sync - if Some(since) >= invite_count { + if Some(since) >= invite_count || Some(next_batch) < invite_count { return invited_rooms; } @@ -270,8 +270,8 @@ pub(crate) async fn build_sync_events( .await .ok(); - // Knocked before last sync - if Some(since) >= knock_count { + // Knocked before last sync; or after the cutoff for this sync + if Some(since) >= knock_count || Some(next_batch) < knock_count { return knocked_rooms; } @@ -439,8 +439,8 @@ async fn handle_left_room( .await .ok(); - // Left before last sync - if Some(since) >= left_count { + // Left before last sync or after cutoff for next sync + if Some(since) >= left_count || Some(next_batch) < left_count { return Ok(None); }