Correctly order when selecting before stream ordering
parent
8363588237
commit
066b9f52b8
|
@ -580,9 +580,12 @@ class StreamWorkerStore(EventsWorkerStore, SQLBaseStore):
|
||||||
" FROM events"
|
" FROM events"
|
||||||
" WHERE room_id = ? AND stream_ordering %s ?"
|
" WHERE room_id = ? AND stream_ordering %s ?"
|
||||||
" AND NOT outlier"
|
" AND NOT outlier"
|
||||||
" ORDER BY stream_ordering"
|
" ORDER BY stream_ordering %s"
|
||||||
" LIMIT 1"
|
" LIMIT 1"
|
||||||
) % ("<=" if dir == "b" else ">=",)
|
) % (
|
||||||
|
"<=" if dir == "b" else ">=",
|
||||||
|
"DESC" if dir == "b" else "ASC",
|
||||||
|
)
|
||||||
txn.execute(sql, (room_id, stream_ordering))
|
txn.execute(sql, (room_id, stream_ordering))
|
||||||
return txn.fetchone()
|
return txn.fetchone()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue