mirror of
https://mau.dev/maunium/synapse.git
synced 2024-12-15 00:13:51 +01:00
Merge pull request #5221 from matrix-org/erikj/fix_worker_sytest
Fix get_max_topological_token to never return None
This commit is contained in:
commit
89d3d7b2c0
2 changed files with 12 additions and 1 deletions
1
changelog.d/5221.bugfix
Normal file
1
changelog.d/5221.bugfix
Normal file
|
@ -0,0 +1 @@
|
|||
Fix race when backfilling in rooms with worker mode.
|
|
@ -592,8 +592,18 @@ class StreamWorkerStore(EventsWorkerStore, SQLBaseStore):
|
|||
)
|
||||
|
||||
def get_max_topological_token(self, room_id, stream_key):
|
||||
"""Get the max topological token in a room before the given stream
|
||||
ordering.
|
||||
|
||||
Args:
|
||||
room_id (str)
|
||||
stream_key (int)
|
||||
|
||||
Returns:
|
||||
Deferred[int]
|
||||
"""
|
||||
sql = (
|
||||
"SELECT max(topological_ordering) FROM events"
|
||||
"SELECT coalesce(max(topological_ordering), 0) FROM events"
|
||||
" WHERE room_id = ? AND stream_ordering < ?"
|
||||
)
|
||||
return self._execute(
|
||||
|
|
Loading…
Reference in a new issue