mirror of
https://github.com/element-hq/synapse
synced 2024-08-20 00:20:25 +00:00
Add cache for is_host_joined
This commit is contained in:
parent
a837765e8c
commit
d53fe399eb
3 changed files with 7 additions and 2 deletions
|
@ -153,7 +153,7 @@ class SlavedEventStore(BaseSlavedStore):
|
||||||
get_room_events_stream_for_rooms = (
|
get_room_events_stream_for_rooms = (
|
||||||
DataStore.get_room_events_stream_for_rooms.__func__
|
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__
|
get_stream_token_for_event = DataStore.get_stream_token_for_event.__func__
|
||||||
|
|
||||||
_set_before_and_after = staticmethod(DataStore._set_before_and_after)
|
_set_before_and_after = staticmethod(DataStore._set_before_and_after)
|
||||||
|
|
|
@ -776,6 +776,11 @@ class EventsStore(SQLBaseStore):
|
||||||
txn, self.get_rooms_for_user, (member,)
|
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(
|
self._invalidate_cache_and_stream(
|
||||||
txn, self.get_users_in_room, (room_id,)
|
txn, self.get_users_in_room, (room_id,)
|
||||||
)
|
)
|
||||||
|
|
|
@ -501,7 +501,7 @@ class RoomMemberStore(SQLBaseStore):
|
||||||
|
|
||||||
defer.returnValue(users_in_room)
|
defer.returnValue(users_in_room)
|
||||||
|
|
||||||
@defer.inlineCallbacks
|
@cachedInlineCallbacks(max_entries=10000)
|
||||||
def is_host_joined(self, room_id, host):
|
def is_host_joined(self, room_id, host):
|
||||||
if '%' in host or '_' in host:
|
if '%' in host or '_' in host:
|
||||||
raise Exception("Invalid host name")
|
raise Exception("Invalid host name")
|
||||||
|
|
Loading…
Reference in a new issue