mirror of
https://git.anonymousland.org/anonymousland/synapse-product.git
synced 2024-12-23 08:49:26 -05:00
Fix bug /sync returning 404 (#12729)
* Fix bug /sync returning 404 Fixes #12571
This commit is contained in:
parent
efcd899f69
commit
8689230a55
1
changelog.d/12729.bugfix
Normal file
1
changelog.d/12729.bugfix
Normal file
@ -0,0 +1 @@
|
|||||||
|
Fix a bug introduced in Synapse 1.58.0 where `/sync` would fail if the most recent event in a room was rejected.
|
@ -743,14 +743,17 @@ class StreamWorkerStore(EventsWorkerStore, SQLBaseStore):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
def _f(txn: LoggingTransaction) -> Optional[Tuple[int, int, str]]:
|
def _f(txn: LoggingTransaction) -> Optional[Tuple[int, int, str]]:
|
||||||
sql = (
|
sql = """
|
||||||
"SELECT stream_ordering, topological_ordering, event_id"
|
SELECT stream_ordering, topological_ordering, event_id
|
||||||
" FROM events"
|
FROM events
|
||||||
" WHERE room_id = ? AND stream_ordering <= ?"
|
LEFT JOIN rejections USING (event_id)
|
||||||
" AND NOT outlier"
|
WHERE room_id = ?
|
||||||
" ORDER BY stream_ordering DESC"
|
AND stream_ordering <= ?
|
||||||
" LIMIT 1"
|
AND NOT outlier
|
||||||
)
|
AND rejections.reason IS NULL
|
||||||
|
ORDER BY stream_ordering DESC
|
||||||
|
LIMIT 1
|
||||||
|
"""
|
||||||
txn.execute(sql, (room_id, stream_ordering))
|
txn.execute(sql, (room_id, stream_ordering))
|
||||||
return cast(Optional[Tuple[int, int, str]], txn.fetchone())
|
return cast(Optional[Tuple[int, int, str]], txn.fetchone())
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user