Don't be too enthusiatic with defer.gatherResults

This commit is contained in:
Erik Johnston 2015-08-07 18:13:48 +01:00
parent b2c7bd4b09
commit ffdb8c3828

View File

@ -405,10 +405,14 @@ class MessageHandler(BaseHandler):
except: except:
logger.exception("Failed to get snapshot") logger.exception("Failed to get snapshot")
yield defer.gatherResults( # Only do N rooms at once
[handle_room(e) for e in room_list], n = 5
consumeErrors=True d_list = [handle_room(e) for e in room_list]
).addErrback(unwrapFirstError) for ds in [d_list[i:i + n] for i in range(0, len(d_list), n)]:
yield defer.gatherResults(
ds,
consumeErrors=True
).addErrback(unwrapFirstError)
ret = { ret = {
"rooms": rooms_ret, "rooms": rooms_ret,