From b849a64f8d467a7b1159b4e8c4db4f3d73696f78 Mon Sep 17 00:00:00 2001 From: Erik Johnston Date: Tue, 16 Jun 2015 17:03:24 +0100 Subject: [PATCH] Use DeferredList --- synapse/handlers/message.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/synapse/handlers/message.py b/synapse/handlers/message.py index 1ed9e961f..de9c6da9e 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()