mirror of
https://git.anonymousland.org/anonymousland/synapse-product.git
synced 2024-10-01 08:25:44 -04: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]]:
|
||||
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())
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user