mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2024-10-01 11:49:51 -04:00
Change public room list to use defer.gatherResults
This commit is contained in:
parent
1fae1b3166
commit
9060dc6b59
@ -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(
|
[
|
||||||
|
self.store.get_users_in_room(
|
||||||
room_id=room["room_id"],
|
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})
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user