0
0
Fork 1
mirror of https://mau.dev/maunium/synapse.git synced 2024-12-14 18:53:53 +01:00

Parellelize initial sync

This commit is contained in:
Erik Johnston 2015-04-15 14:17:16 +01:00
parent 25d2914fba
commit 1ec6fa98c9

View file

@ -274,7 +274,8 @@ class MessageHandler(BaseHandler):
if limit is None:
limit = 10
for event in room_list:
@defer.inlineCallbacks
def handle_room(event):
d = {
"room_id": event.room_id,
"membership": event.membership,
@ -290,7 +291,7 @@ class MessageHandler(BaseHandler):
rooms_ret.append(d)
if event.membership != Membership.JOIN:
continue
return
try:
messages, token = yield self.store.get_recent_events_for_room(
event.room_id,
@ -321,6 +322,11 @@ class MessageHandler(BaseHandler):
except:
logger.exception("Failed to get snapshot")
yield defer.gatherResults(
[handle_room(e) for e in room_list],
consumeErrors=True
)
ret = {
"rooms": rooms_ret,
"presence": presence,