diff options
author | Erik Johnston <erikj@element.io> | 2024-01-10 14:31:35 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-10 14:31:35 +0000 |
commit | 578c5c736e4ca2479c8b72b5e9ac20cd7acde0e8 (patch) | |
tree | c1691e4db32a6108553e1f744f00dd13ad9a1a5f /synapse/handlers | |
parent | Split up deleting devices into batches (#16766) (diff) | |
download | synapse-578c5c736e4ca2479c8b72b5e9ac20cd7acde0e8.tar.xz |
Reduce amount of state pulled out when querying federation hierachy (#16785)
There are two changes here: 1. Only pull out the required state when handling the request. 2. Change the get filtered state return type to check that we're only querying state that was requested --------- Co-authored-by: reivilibre <oliverw@matrix.org>
Diffstat (limited to 'synapse/handlers')
-rw-r--r-- | synapse/handlers/room_summary.py | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/synapse/handlers/room_summary.py b/synapse/handlers/room_summary.py index a534f5f280..78bcac1429 100644 --- a/synapse/handlers/room_summary.py +++ b/synapse/handlers/room_summary.py @@ -44,6 +44,7 @@ from synapse.api.ratelimiting import Ratelimiter from synapse.config.ratelimiting import RatelimitSettings from synapse.events import EventBase from synapse.types import JsonDict, Requester, StrCollection +from synapse.types.state import StateFilter from synapse.util.caches.response_cache import ResponseCache if TYPE_CHECKING: @@ -546,7 +547,16 @@ class RoomSummaryHandler: Returns: True if the room is accessible to the requesting user or server. """ - state_ids = await self._storage_controllers.state.get_current_state_ids(room_id) + event_types = [ + (EventTypes.JoinRules, ""), + (EventTypes.RoomHistoryVisibility, ""), + ] + if requester: + event_types.append((EventTypes.Member, requester)) + + state_ids = await self._storage_controllers.state.get_current_state_ids( + room_id, state_filter=StateFilter.from_types(event_types) + ) # If there's no state for the room, it isn't known. if not state_ids: |