diff options
author | Erik Johnston <erik@matrix.org> | 2021-05-05 16:49:34 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-05-05 16:49:34 +0100 |
commit | d0aee697ac0587c005bc1048f5036979331f1101 (patch) | |
tree | c0bf6d4529c11b59fde71533b4e06def8e196375 /synapse/state/__init__.py | |
parent | Docker healthcheck timings - add startup delay and changed interval (#9913) (diff) | |
download | synapse-d0aee697ac0587c005bc1048f5036979331f1101.tar.xz |
Use get_current_users_in_room from store and not StateHandler (#9910)
Diffstat (limited to 'synapse/state/__init__.py')
-rw-r--r-- | synapse/state/__init__.py | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/synapse/state/__init__.py b/synapse/state/__init__.py index b3bd92d37c..a1770f620e 100644 --- a/synapse/state/__init__.py +++ b/synapse/state/__init__.py @@ -213,19 +213,23 @@ class StateHandler: return ret.state async def get_current_users_in_room( - self, room_id: str, latest_event_ids: Optional[List[str]] = None + self, room_id: str, latest_event_ids: List[str] ) -> Dict[str, ProfileInfo]: """ Get the users who are currently in a room. + Note: This is much slower than using the equivalent method + `DataStore.get_users_in_room` or `DataStore.get_users_in_room_with_profiles`, + so this should only be used when wanting the users at a particular point + in the room. + Args: room_id: The ID of the room. latest_event_ids: Precomputed list of latest event IDs. Will be computed if None. Returns: Dictionary of user IDs to their profileinfo. """ - if not latest_event_ids: - latest_event_ids = await self.store.get_latest_event_ids_in_room(room_id) + assert latest_event_ids is not None logger.debug("calling resolve_state_groups from get_current_users_in_room") |