diff options
author | Erik Johnston <erik@matrix.org> | 2016-06-02 12:47:06 +0100 |
---|---|---|
committer | Erik Johnston <erik@matrix.org> | 2016-06-03 11:20:23 +0100 |
commit | ccb56fc24bd7d2675dc21796b29333538ca0d5fa (patch) | |
tree | ee405997b7645baef330c138834272297f4be0b3 | |
parent | Merge pull request #811 from matrix-org/erikj/state_users_in_room (diff) | |
download | synapse-ccb56fc24bd7d2675dc21796b29333538ca0d5fa.tar.xz |
Make get_joined_hosts_for_room use get_users_in_room
Diffstat (limited to '')
-rw-r--r-- | synapse/storage/roommember.py | 19 |
1 files changed, 3 insertions, 16 deletions
diff --git a/synapse/storage/roommember.py b/synapse/storage/roommember.py index 41b395e07c..64b4bd371b 100644 --- a/synapse/storage/roommember.py +++ b/synapse/storage/roommember.py @@ -238,23 +238,10 @@ class RoomMemberStore(SQLBaseStore): 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( |