summary refs log tree commit diff
path: root/synapse
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2015-06-16 17:03:24 +0100
committerErik Johnston <erik@matrix.org>2015-06-16 17:03:24 +0100
commitb849a64f8d467a7b1159b4e8c4db4f3d73696f78 (patch)
treef3cd98ef9e2aa862b5ab6a77b4c24849a6b305b1 /synapse
parentDon't do unecessary db ops in presence.get_state (diff)
downloadsynapse-b849a64f8d467a7b1159b4e8c4db4f3d73696f78.tar.xz
Use DeferredList
Diffstat (limited to '')
-rw-r--r--synapse/handlers/message.py18
1 files changed, 9 insertions, 9 deletions
diff --git a/synapse/handlers/message.py b/synapse/handlers/message.py
index 1ed9e961f1..de9c6da9ec 100644
--- a/synapse/handlers/message.py
+++ b/synapse/handlers/message.py
@@ -396,20 +396,20 @@ class MessageHandler(BaseHandler):
         ]
 
         presence_handler = self.hs.get_handlers().presence_handler
-        presence = []
-        for m in room_members:
-            try:
-                member_presence = yield presence_handler.get_state(
+        presence_defs = yield defer.DeferredList(
+            [
+                presence_handler.get_state(
                     target_user=UserID.from_string(m.user_id),
                     auth_user=auth_user,
                     as_event=True,
                     check_auth=False,
                 )
-                presence.append(member_presence)
-            except SynapseError:
-                logger.exception(
-                    "Failed to get member presence of %r", m.user_id
-                )
+                for m in room_members
+            ],
+            consumeErrors=True,
+        )
+
+        presence = [p for success, p in presence_defs if success]
 
         time_now = self.clock.time_msec()