diff options
author | Erik Johnston <erikj@element.io> | 2024-07-24 15:21:56 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-07-24 15:21:56 +0100 |
commit | bdf37ad4c4d66c7a2ca69a29542b01e0856cff48 (patch) | |
tree | c99542243631e7d836b63e999bcc51c577a0e532 /synapse/handlers/sliding_sync.py | |
parent | Use a new token format for sliding sync (#17452) (diff) | |
download | synapse-bdf37ad4c4d66c7a2ca69a29542b01e0856cff48.tar.xz |
Sliding Sync: ensure bump stamp ignores backfilled events (#17478)
Backfill events have a negative stream ordering, and so its not useful to use to compare with other (positive) stream orderings. Plus, the Rust SDK currently assumes `bump_stamp` is positive.
Diffstat (limited to 'synapse/handlers/sliding_sync.py')
-rw-r--r-- | synapse/handlers/sliding_sync.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/synapse/handlers/sliding_sync.py b/synapse/handlers/sliding_sync.py index 36665db8e1..f1f6f30b95 100644 --- a/synapse/handlers/sliding_sync.py +++ b/synapse/handlers/sliding_sync.py @@ -1758,8 +1758,14 @@ class SlidingSyncHandler: bump_stamp = room_membership_for_user_at_to_token.event_pos.stream # But if we found a bump event, use that instead if last_bump_event_result is not None: - _, bump_event_pos = last_bump_event_result - bump_stamp = bump_event_pos.stream + _, new_bump_event_pos = last_bump_event_result + + # If we've just joined a remote room, then the last bump event may + # have been backfilled (and so have a negative stream ordering). + # These negative stream orderings can't sensibly be compared, so + # instead we use the membership event position. + if new_bump_event_pos.stream > 0: + bump_stamp = new_bump_event_pos.stream return SlidingSyncResult.RoomResult( name=room_name, |