Use DeferredList

This commit is contained in:
Erik Johnston 2015-06-16 17:03:24 +01:00
parent 0460406298
commit b849a64f8d

View File

@ -396,21 +396,21 @@ 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()
defer.returnValue({