Skip to content
Snippets Groups Projects
Commit 9060dc6b authored by Erik Johnston's avatar Erik Johnston
Browse files

Change public room list to use defer.gatherResults

parent 1fae1b31
No related branches found
No related tags found
No related merge requests found
...@@ -529,11 +529,19 @@ class RoomListHandler(BaseHandler): ...@@ -529,11 +529,19 @@ class RoomListHandler(BaseHandler):
@defer.inlineCallbacks @defer.inlineCallbacks
def get_public_room_list(self): def get_public_room_list(self):
chunk = yield self.store.get_rooms(is_public=True) chunk = yield self.store.get_rooms(is_public=True)
for room in chunk: results = yield defer.gatherResults(
joined_users = yield self.store.get_users_in_room( [
room_id=room["room_id"], self.store.get_users_in_room(
) room_id=room["room_id"],
room["num_joined_members"] = len(joined_users) )
for room in chunk
],
consumeErrors=True,
)
for i, room in enumerate(chunk):
room["num_joined_members"] = len(len(results[i]))
# FIXME (erikj): START is no longer a valid value # FIXME (erikj): START is no longer a valid value
defer.returnValue({"start": "START", "end": "END", "chunk": chunk}) defer.returnValue({"start": "START", "end": "END", "chunk": chunk})
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment