summary refs log tree commit diff
path: root/synapse/visibility.py
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2018-10-19 15:48:59 +0100
committerErik Johnston <erik@matrix.org>2018-10-19 15:48:59 +0100
commit056f0991262902e22f0414e17c01198e1606384a (patch)
treefa365dc1aef28f86499122d8b9176c03dd95e863 /synapse/visibility.py
parentBatch process handling state groups (diff)
parentFix manhole on py3 (pt 2) (#4067) (diff)
downloadsynapse-056f0991262902e22f0414e17c01198e1606384a.tar.xz
Merge branch 'develop' of github.com:matrix-org/synapse into erikj/purge_state_groups
Diffstat (limited to 'synapse/visibility.py')
-rw-r--r--synapse/visibility.py15
1 files changed, 7 insertions, 8 deletions
diff --git a/synapse/visibility.py b/synapse/visibility.py
index d4680863d3..43f48196be 100644
--- a/synapse/visibility.py
+++ b/synapse/visibility.py
@@ -219,7 +219,7 @@ def filter_events_for_server(store, server_name, events):
     # Whatever else we do, we need to check for senders which have requested
     # erasure of their data.
     erased_senders = yield store.are_users_erased(
-        e.sender for e in events,
+        (e.sender for e in events),
     )
 
     def redact_disallowed(event, state):
@@ -324,14 +324,13 @@ def filter_events_for_server(store, server_name, events):
     # server's domain.
     #
     # event_to_state_ids contains lots of duplicates, so it turns out to be
-    # cheaper to build a complete set of unique
-    # ((type, state_key), event_id) tuples, and then filter out the ones we
-    # don't want.
+    # cheaper to build a complete event_id => (type, state_key) dict, and then
+    # filter out the ones we don't want
     #
-    state_key_to_event_id_set = {
-        e
+    event_id_to_state_key = {
+        event_id: key
         for key_to_eid in itervalues(event_to_state_ids)
-        for e in key_to_eid.items()
+        for key, event_id in iteritems(key_to_eid)
     }
 
     def include(typ, state_key):
@@ -346,7 +345,7 @@ def filter_events_for_server(store, server_name, events):
 
     event_map = yield store.get_events([
         e_id
-        for key, e_id in state_key_to_event_id_set
+        for e_id, key in iteritems(event_id_to_state_key)
         if include(key[0], key[1])
     ])