mirror of
https://github.com/element-hq/synapse
synced 2024-08-19 12:40:20 +00:00
Select to_key if to_key else from_key
See https://github.com/element-hq/synapse/pull/17320#discussion_r1646591886
This commit is contained in:
parent
e4195875b9
commit
2bd6cba76d
1 changed files with 6 additions and 2 deletions
|
@ -1827,7 +1827,9 @@ class StreamWorkerStore(EventsWorkerStore, SQLBaseStore):
|
|||
and to_key is not None
|
||||
and to_key.is_before_or_eq(from_key)
|
||||
):
|
||||
return [], from_key
|
||||
# Token selection matches what we do in `_paginate_room_events_txn` if there
|
||||
# are no rows
|
||||
return [], to_key if to_key else from_key
|
||||
# Or vice-versa, if we're looking backwards and our `from_key` is already before
|
||||
# our `to_key`.
|
||||
elif (
|
||||
|
@ -1835,7 +1837,9 @@ class StreamWorkerStore(EventsWorkerStore, SQLBaseStore):
|
|||
and to_key is not None
|
||||
and from_key.is_before_or_eq(to_key)
|
||||
):
|
||||
return [], from_key
|
||||
# Token selection matches what we do in `_paginate_room_events_txn` if there
|
||||
# are no rows
|
||||
return [], to_key if to_key else from_key
|
||||
|
||||
rows, token = await self.db_pool.runInteraction(
|
||||
"paginate_room_events",
|
||||
|
|
Loading…
Reference in a new issue