Fix sequence windowing for sync v3 invite/leave/knock rooms.

Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
Jason Volk
2025-07-25 12:03:40 +00:00
parent 22ef704ac6
commit 0d439188e8

View File

@@ -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);
}