summary refs log tree commit diff
path: root/synapse/storage
diff options
context:
space:
mode:
authorBrendan Abolivier <babolivier@matrix.org>2020-01-15 19:32:47 +0000
committerBrendan Abolivier <babolivier@matrix.org>2020-01-15 19:32:47 +0000
commit066b9f52b80c172eec6074ca01fb24670200fd80 (patch)
tree6483cdb3c2a460b175d620c170462c09e69fa418 /synapse/storage
parentFix typo (diff)
downloadsynapse-066b9f52b80c172eec6074ca01fb24670200fd80.tar.xz
Correctly order when selecting before stream ordering
Diffstat (limited to 'synapse/storage')
-rw-r--r--synapse/storage/data_stores/main/stream.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/synapse/storage/data_stores/main/stream.py b/synapse/storage/data_stores/main/stream.py

index 9fa5e1f203..451f38296b 100644 --- a/synapse/storage/data_stores/main/stream.py +++ b/synapse/storage/data_stores/main/stream.py
@@ -580,9 +580,12 @@ class StreamWorkerStore(EventsWorkerStore, SQLBaseStore): " FROM events" " WHERE room_id = ? AND stream_ordering %s ?" " AND NOT outlier" - " ORDER BY stream_ordering" + " ORDER BY stream_ordering %s" " LIMIT 1" - ) % ("<=" if dir == "b" else ">=",) + ) % ( + "<=" if dir == "b" else ">=", + "DESC" if dir == "b" else "ASC", + ) txn.execute(sql, (room_id, stream_ordering)) return txn.fetchone()