diff options
author | Brendan Abolivier <babolivier@matrix.org> | 2020-01-15 19:32:47 +0000 |
---|---|---|
committer | Brendan Abolivier <babolivier@matrix.org> | 2020-01-15 19:32:47 +0000 |
commit | 066b9f52b80c172eec6074ca01fb24670200fd80 (patch) | |
tree | 6483cdb3c2a460b175d620c170462c09e69fa418 | |
parent | Fix typo (diff) | |
download | synapse-066b9f52b80c172eec6074ca01fb24670200fd80.tar.xz |
Correctly order when selecting before stream ordering
-rw-r--r-- | synapse/storage/data_stores/main/stream.py | 7 |
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() |