Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Commit

Permalink
Only check membership events persisted after the get rooms call
Browse files Browse the repository at this point in the history
  • Loading branch information
Fizzadar committed Oct 4, 2022
1 parent ef2950a commit a82b8d7
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions synapse/handlers/sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -1324,6 +1324,7 @@ async def generate_sync_result(

# Note: we get the users room list *before* we get the current token, this
# avoids checking back in history if rooms are joined after the token is fetched.
token_before_rooms = self.event_sources.get_current_token()
mutable_joined_room_ids = set(await self.store.get_rooms_for_user(user_id))

# NB: The now_token gets changed by some of the generate_sync_* methods,
Expand Down Expand Up @@ -1352,6 +1353,13 @@ async def generate_sync_result(
# latest change is JOIN.

for room_id, event in mem_last_change_by_room_id.items():
assert event.internal_metadata.stream_ordering
if (
event.internal_metadata.stream_ordering
< token_before_rooms.room_key.stream
):
continue

logger.info(
"User membership change between getting rooms and current token: %s %s %s",
user_id,
Expand Down

0 comments on commit a82b8d7

Please sign in to comment.