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

Commit

Permalink
Fixup get_room_max_token
Browse files Browse the repository at this point in the history
  • Loading branch information
erikjohnston committed Oct 6, 2020
1 parent 604e33f commit 6425f43
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions synapse/storage/databases/main/stream.py
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,14 @@ def get_room_min_stream_ordering(self) -> int:
raise NotImplementedError()

def get_room_max_token(self) -> RoomStreamToken:
"""Get a `RoomStreamToken` that marks the current maximum persisted
position of the events stream. Useful to get a token that represents
"now".
The token returned is a "live" token that may have an instance_map
component.
"""

min_pos = self._stream_id_gen.get_current_token()

positions = {}
Expand All @@ -372,9 +380,6 @@ def get_room_max_token(self) -> RoomStreamToken:
if p > min_pos
}

if set(positions.values()) == {min_pos}:
positions = {}

return RoomStreamToken(None, min_pos, positions)

async def get_room_events_stream_for_rooms(
Expand Down

0 comments on commit 6425f43

Please sign in to comment.