mirror of
https://mau.dev/maunium/synapse.git
synced 2024-12-17 23:23:52 +01:00
Fix get_max_topological_token to never return None
This commit is contained in:
parent
04d53794d6
commit
7b0e804a4a
1 changed files with 11 additions and 1 deletions
|
@ -592,8 +592,18 @@ class StreamWorkerStore(EventsWorkerStore, SQLBaseStore):
|
||||||
)
|
)
|
||||||
|
|
||||||
def get_max_topological_token(self, room_id, stream_key):
|
def get_max_topological_token(self, room_id, stream_key):
|
||||||
|
"""Get the max topological token in a room that before given stream
|
||||||
|
ordering.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
room_id (str)
|
||||||
|
stream_key (int)
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
Deferred[int]
|
||||||
|
"""
|
||||||
sql = (
|
sql = (
|
||||||
"SELECT max(topological_ordering) FROM events"
|
"SELECT coalesce(max(topological_ordering), 0) FROM events"
|
||||||
" WHERE room_id = ? AND stream_ordering < ?"
|
" WHERE room_id = ? AND stream_ordering < ?"
|
||||||
)
|
)
|
||||||
return self._execute(
|
return self._execute(
|
||||||
|
|
Loading…
Reference in a new issue