Skip to content

Commit 5c22941

Browse files
committed
Revert "Look for bump stamp in the room timeline"
This reverts commit a3c4956.
1 parent a3c4956 commit 5c22941

File tree

1 file changed

+12
-24
lines changed

1 file changed

+12
-24
lines changed

synapse/handlers/sliding_sync/__init__.py

+12-24
Original file line numberDiff line numberDiff line change
@@ -1045,36 +1045,24 @@ async def get_room_sync_data(
10451045

10461046
# Figure out the last bump event in the room if we're in the room.
10471047
if room_membership_for_user_at_to_token.membership == Membership.JOIN:
1048-
new_bump_stamp: Optional[int] = None
1049-
1050-
# First check the timeline events we're returning to see if one of
1051-
# those matches. We iterate backwards and take the stream ordering
1052-
# of the first event that matches the bump event types.
1053-
for timeline_event in reversed(timeline_events):
1054-
if timeline_event.type in SLIDING_SYNC_DEFAULT_BUMP_EVENT_TYPES:
1055-
new_bump_stamp = timeline_event.internal_metadata.stream_ordering
1056-
break
1057-
else:
1058-
# If not then we query the DB for it.
1059-
last_bump_event_result = (
1060-
await self.store.get_last_event_pos_in_room_before_stream_ordering(
1061-
room_id,
1062-
to_token.room_key,
1063-
event_types=SLIDING_SYNC_DEFAULT_BUMP_EVENT_TYPES,
1064-
)
1048+
last_bump_event_result = (
1049+
await self.store.get_last_event_pos_in_room_before_stream_ordering(
1050+
room_id,
1051+
to_token.room_key,
1052+
event_types=SLIDING_SYNC_DEFAULT_BUMP_EVENT_TYPES,
10651053
)
1066-
if last_bump_event_result is not None:
1067-
_, new_bump_event_pos = last_bump_event_result
1068-
new_bump_stamp = new_bump_event_pos.stream
1054+
)
1055+
1056+
# But if we found a bump event, use that instead
1057+
if last_bump_event_result is not None:
1058+
_, new_bump_event_pos = last_bump_event_result
10691059

1070-
# If we found a bump event, use that instead
1071-
if new_bump_stamp is not None:
10721060
# If we've just joined a remote room, then the last bump event may
10731061
# have been backfilled (and so have a negative stream ordering).
10741062
# These negative stream orderings can't sensibly be compared, so
10751063
# instead we use the membership event position.
1076-
if new_bump_stamp > 0:
1077-
bump_stamp = new_bump_stamp
1064+
if new_bump_event_pos.stream > 0:
1065+
bump_stamp = new_bump_event_pos.stream
10781066

10791067
unstable_expanded_timeline = False
10801068
prev_room_sync_config = previous_connection_state.room_configs.get(room_id)

0 commit comments

Comments
 (0)