summary refs log tree commit diff
path: root/synapse/storage/events.py
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2016-03-18 15:02:43 +0000
committerErik Johnston <erik@matrix.org>2016-03-18 15:02:43 +0000
commit1660145a082470b2d390406a7ed0fed765d44d70 (patch)
treed9c154f0f5ebe5311b74c128f4e17b4846eebbc4 /synapse/storage/events.py
parentYield on EDU handling (diff)
parentMerge pull request #656 from matrix-org/erikj/get_event (diff)
downloadsynapse-1660145a082470b2d390406a7ed0fed765d44d70.tar.xz
Merge branch 'develop' of github.com:matrix-org/synapse into erikj/edu_yield
Diffstat (limited to 'synapse/storage/events.py')
-rw-r--r--synapse/storage/events.py26
1 files changed, 12 insertions, 14 deletions
diff --git a/synapse/storage/events.py b/synapse/storage/events.py
index 552e7ca35b..285c586cfe 100644
--- a/synapse/storage/events.py
+++ b/synapse/storage/events.py
@@ -526,6 +526,9 @@ class EventsStore(SQLBaseStore):
         if not event_ids:
             defer.returnValue([])
 
+        event_id_list = event_ids
+        event_ids = set(event_ids)
+
         event_map = self._get_events_from_cache(
             event_ids,
             check_redacted=check_redacted,
@@ -535,23 +538,18 @@ class EventsStore(SQLBaseStore):
 
         missing_events_ids = [e for e in event_ids if e not in event_map]
 
-        if not missing_events_ids:
-            defer.returnValue([
-                event_map[e_id] for e_id in event_ids
-                if e_id in event_map and event_map[e_id]
-            ])
-
-        missing_events = yield self._enqueue_events(
-            missing_events_ids,
-            check_redacted=check_redacted,
-            get_prev_content=get_prev_content,
-            allow_rejected=allow_rejected,
-        )
+        if missing_events_ids:
+            missing_events = yield self._enqueue_events(
+                missing_events_ids,
+                check_redacted=check_redacted,
+                get_prev_content=get_prev_content,
+                allow_rejected=allow_rejected,
+            )
 
-        event_map.update(missing_events)
+            event_map.update(missing_events)
 
         defer.returnValue([
-            event_map[e_id] for e_id in event_ids
+            event_map[e_id] for e_id in event_id_list
             if e_id in event_map and event_map[e_id]
         ])