diff options
author | Erik Johnston <erik@matrix.org> | 2022-06-06 11:24:12 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-06 09:24:12 +0100 |
commit | e3163e2e11cf8bffa4cb3e58ac0b86a83eca314c (patch) | |
tree | 639271e4b4d4157b95047f801f6b22bf39a24f08 /synapse/handlers/room_member.py | |
parent | Remove groups code from synapse_port_db. (#12899) (diff) | |
download | synapse-e3163e2e11cf8bffa4cb3e58ac0b86a83eca314c.tar.xz |
Reduce the amount of state we pull from the DB (#12811)
Diffstat (limited to 'synapse/handlers/room_member.py')
-rw-r--r-- | synapse/handlers/room_member.py | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/synapse/handlers/room_member.py b/synapse/handlers/room_member.py index 70c674ff8e..d1199a0644 100644 --- a/synapse/handlers/room_member.py +++ b/synapse/handlers/room_member.py @@ -1401,7 +1401,19 @@ class RoomMemberHandler(metaclass=abc.ABCMeta): txn_id: Optional[str], id_access_token: Optional[str] = None, ) -> int: - room_state = await self.state_handler.get_current_state(room_id) + room_state = await self._storage_controllers.state.get_current_state( + room_id, + StateFilter.from_types( + [ + (EventTypes.Member, user.to_string()), + (EventTypes.CanonicalAlias, ""), + (EventTypes.Name, ""), + (EventTypes.Create, ""), + (EventTypes.JoinRules, ""), + (EventTypes.RoomAvatar, ""), + ] + ), + ) inviter_display_name = "" inviter_avatar_url = "" @@ -1797,7 +1809,7 @@ class RoomMemberMasterHandler(RoomMemberHandler): async def forget(self, user: UserID, room_id: str) -> None: user_id = user.to_string() - member = await self.state_handler.get_current_state( + member = await self._storage_controllers.state.get_current_state_event( room_id=room_id, event_type=EventTypes.Member, state_key=user_id ) membership = member.membership if member else None |