diff options
author | Erik Johnston <erik@matrix.org> | 2019-05-21 15:21:38 +0100 |
---|---|---|
committer | Erik Johnston <erik@matrix.org> | 2019-05-21 15:21:43 +0100 |
commit | 7b0e804a4a684a210abf5107e720582f68f464e7 (patch) | |
tree | c74576f6756c04f0f32aa8902d7b10dc1bb2379c /synapse/storage/stream.py | |
parent | Fix error handling for rooms whose versions are unknown. (#5219) (diff) | |
download | synapse-7b0e804a4a684a210abf5107e720582f68f464e7.tar.xz |
Fix get_max_topological_token to never return None
Diffstat (limited to 'synapse/storage/stream.py')
-rw-r--r-- | synapse/storage/stream.py | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/synapse/storage/stream.py b/synapse/storage/stream.py index 529ad4ea79..0b5f5f9663 100644 --- a/synapse/storage/stream.py +++ b/synapse/storage/stream.py @@ -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 that before 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( |