Correctly order when selecting before stream ordering

This commit is contained in:
Brendan Abolivier 2020-01-15 19:32:47 +00:00
parent 8363588237
commit 066b9f52b8
No known key found for this signature in database
GPG key ID: 1E015C145F1916CD

View file

@ -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()