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

Commit 00f81f0

Browse files
committed
Use new order_by argument to get events in stream order
1 parent 78e3df8 commit 00f81f0

File tree

2 files changed

+8
-10
lines changed

2 files changed

+8
-10
lines changed

Diff for: synapse/handlers/message.py

+4-5
Original file line numberDiff line numberDiff line change
@@ -175,12 +175,11 @@ async def get_state_events(
175175
state_filter = state_filter or StateFilter.all()
176176

177177
if at_token:
178-
# FIXME this claims to get the state at a stream position, but
179-
# get_recent_events_for_room operates by topo ordering. This therefore
180-
# does not reliably give you the state at the given stream position.
181-
# (https://github.com/matrix-org/synapse/issues/3305)
182178
last_events, _ = await self.store.get_recent_events_for_room(
183-
room_id, end_token=at_token.room_key, limit=1
179+
room_id,
180+
end_token=at_token.room_key,
181+
limit=1,
182+
order_by="stream",
184183
)
185184

186185
if not last_events:

Diff for: synapse/handlers/sync.py

+4-5
Original file line numberDiff line numberDiff line change
@@ -683,12 +683,11 @@ async def get_state_at(
683683
stream_position: point at which to get state
684684
state_filter: The state filter used to fetch state from the database.
685685
"""
686-
# FIXME this claims to get the state at a stream position, but
687-
# get_recent_events_for_room operates by topo ordering. This therefore
688-
# does not reliably give you the state at the given stream position.
689-
# (https://github.com/matrix-org/synapse/issues/3305)
690686
last_events, _ = await self.store.get_recent_events_for_room(
691-
room_id, end_token=stream_position.room_key, limit=1
687+
room_id,
688+
end_token=stream_position.room_key,
689+
limit=1,
690+
order_by="stream",
692691
)
693692

694693
if last_events:

0 commit comments

Comments
 (0)