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

Commit

Permalink
Fix bug /sync returning 404
Browse files Browse the repository at this point in the history
Fixes #12571
  • Loading branch information
erikjohnston committed May 13, 2022
1 parent efcd899 commit fed9bba
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions synapse/storage/databases/main/stream.py
Original file line number Diff line number Diff line change
Expand Up @@ -743,14 +743,17 @@ async def get_room_event_before_stream_ordering(
"""

def _f(txn: LoggingTransaction) -> Optional[Tuple[int, int, str]]:
sql = (
"SELECT stream_ordering, topological_ordering, event_id"
" FROM events"
" WHERE room_id = ? AND stream_ordering <= ?"
" AND NOT outlier"
" ORDER BY stream_ordering DESC"
" LIMIT 1"
)
sql = """
SELECT stream_ordering, topological_ordering, event_id
FROM events
LEFT JOIN rejections USING (event_id)
WHERE room_id = ?
AND stream_ordering <= ?
AND NOT outlier
AND rejections.reason IS NULL
ORDER BY stream_ordering DESC
LIMIT 1
"""
txn.execute(sql, (room_id, stream_ordering))
return cast(Optional[Tuple[int, int, str]], txn.fetchone())

Expand Down

0 comments on commit fed9bba

Please sign in to comment.