summary refs log tree commit diff
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2020-02-03 12:35:04 +0000
committerErik Johnston <erik@matrix.org>2020-02-03 12:35:04 +0000
commit78589c3b4a7c3928c84611bfc2a6d863eb2c16a0 (patch)
treef4a92daf76381b1d00b3259fddf04f7f959c10ad
parentFix up return types (diff)
downloadsynapse-78589c3b4a7c3928c84611bfc2a6d863eb2c16a0.tar.xz
Assert instead of handling
-rw-r--r--synapse/handlers/sync.py13
1 files changed, 7 insertions, 6 deletions
diff --git a/synapse/handlers/sync.py b/synapse/handlers/sync.py
index 5b16d735a2..8e4eda91aa 100644
--- a/synapse/handlers/sync.py
+++ b/synapse/handlers/sync.py
@@ -845,12 +845,13 @@ class SyncHandler(object):
                 # about them).
                 state_filter = StateFilter.all()
 
-                if since_token:
-                    state_at_previous_sync = await self.get_state_at(
-                        room_id, stream_position=since_token, state_filter=state_filter
-                    )
-                else:
-                    state_at_previous_sync = {}
+                # If this is an initial sync then full_state should be set, and
+                # that case is handled above. We assert here to ensure that this
+                # is indeed the case.
+                assert since_token is not None
+                state_at_previous_sync = await self.get_state_at(
+                    room_id, stream_position=since_token, state_filter=state_filter
+                )
 
                 if batch:
                     current_state_ids = await self.state_store.get_state_ids_for_event(