summary refs log tree commit diff
path: root/synapse/storage/state.py
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2015-08-18 11:44:10 +0100
committerErik Johnston <erik@matrix.org>2015-08-18 11:44:10 +0100
commit8199475ce062c8ed7b050ddecd51c6c3ec22e560 (patch)
tree145add1524677b92a4c2200635efd5876c471b4b /synapse/storage/state.py
parentTypo (diff)
downloadsynapse-8199475ce062c8ed7b050ddecd51c6c3ec22e560.tar.xz
Ensure we never return a None event from _get_state_for_groups
Diffstat (limited to '')
-rw-r--r--synapse/storage/state.py11
1 files changed, 8 insertions, 3 deletions
diff --git a/synapse/storage/state.py b/synapse/storage/state.py
index ab3ad5a076..b321412813 100644
--- a/synapse/storage/state.py
+++ b/synapse/storage/state.py
@@ -405,16 +405,21 @@ class StateStore(SQLBaseStore):
                 state_event = state_events[event_id]
                 state_dict[(state_event.type, state_event.state_key)] = state_event
 
+            results[group] = state_dict
+
             self._state_group_cache.update(
                 cache_seq_num,
                 key=group,
-                value=state_dict,
+                value=results[group],
                 full=(types is None),
             )
 
-            # We replace here to remove all the entries with None values.
+        # Remove all the entries with None values. The None values were just
+        # used for bookkeeping in the cache.
+        for group, state_dict in results.items():
             results[group] = {
-                key: value for key, value in state_dict.items() if value
+                key: event for key, event in state_dict.items()
+                if event
             }
 
         defer.returnValue(results)