Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Make get_joined_hosts_for_room use get_users_in_room #828

Merged
merged 1 commit into from
Jun 3, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 3 additions & 16 deletions synapse/storage/roommember.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,23 +238,10 @@ def _get_rooms_for_user_where_membership_is_txn(self, txn, user_id,

return results

@cached(max_entries=5000)
@cachedInlineCallbacks(max_entries=5000)
def get_joined_hosts_for_room(self, room_id):
return self.runInteraction(
"get_joined_hosts_for_room",
self._get_joined_hosts_for_room_txn,
room_id,
)

def _get_joined_hosts_for_room_txn(self, txn, room_id):
rows = self._get_members_rows_txn(
txn,
room_id, membership=Membership.JOIN
)

joined_domains = set(get_domain_from_id(r["user_id"]) for r in rows)

return joined_domains
user_ids = yield self.get_users_in_room(room_id)
defer.returnValue(set(get_domain_from_id(uid) for uid in user_ids))

def _get_members_events_txn(self, txn, room_id, membership=None, user_id=None):
rows = self._get_members_rows_txn(
Expand Down