diff options
author | Erik Johnston <erikj@jki.re> | 2017-06-13 10:58:53 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-06-13 10:58:53 +0100 |
commit | fdca6e36ee66b01ebbc7325e42fb811c1aec5b25 (patch) | |
tree | da27a8f8e272b88ede975d25b592c7b2e29b4508 /synapse | |
parent | Merge pull request #2275 from matrix-org/erikj/tweark_user_directory_search (diff) | |
parent | Add cache for is_host_joined (diff) | |
download | synapse-fdca6e36ee66b01ebbc7325e42fb811c1aec5b25.tar.xz |
Merge pull request #2274 from matrix-org/erikj/cache_is_host_joined
Add cache for is_host_joined
Diffstat (limited to 'synapse')
-rw-r--r-- | synapse/replication/slave/storage/events.py | 2 | ||||
-rw-r--r-- | synapse/storage/events.py | 5 | ||||
-rw-r--r-- | synapse/storage/roommember.py | 2 |
3 files changed, 7 insertions, 2 deletions
diff --git a/synapse/replication/slave/storage/events.py b/synapse/replication/slave/storage/events.py index 7034f48b50..94ebbffc1b 100644 --- a/synapse/replication/slave/storage/events.py +++ b/synapse/replication/slave/storage/events.py @@ -153,7 +153,7 @@ class SlavedEventStore(BaseSlavedStore): get_room_events_stream_for_rooms = ( DataStore.get_room_events_stream_for_rooms.__func__ ) - is_host_joined = DataStore.is_host_joined.__func__ + is_host_joined = RoomMemberStore.__dict__["is_host_joined"] get_stream_token_for_event = DataStore.get_stream_token_for_event.__func__ _set_before_and_after = staticmethod(DataStore._set_before_and_after) diff --git a/synapse/storage/events.py b/synapse/storage/events.py index c80d181fc7..72ce84b0b8 100644 --- a/synapse/storage/events.py +++ b/synapse/storage/events.py @@ -776,6 +776,11 @@ class EventsStore(SQLBaseStore): txn, self.get_rooms_for_user, (member,) ) + for host in set(get_domain_from_id(u) for u in members_changed): + self._invalidate_cache_and_stream( + txn, self.is_host_joined, (room_id, host) + ) + self._invalidate_cache_and_stream( txn, self.get_users_in_room, (room_id,) ) diff --git a/synapse/storage/roommember.py b/synapse/storage/roommember.py index e38bbd22a3..457ca288d0 100644 --- a/synapse/storage/roommember.py +++ b/synapse/storage/roommember.py @@ -501,7 +501,7 @@ class RoomMemberStore(SQLBaseStore): defer.returnValue(users_in_room) - @defer.inlineCallbacks + @cachedInlineCallbacks(max_entries=10000) def is_host_joined(self, room_id, host): if '%' in host or '_' in host: raise Exception("Invalid host name") |