diff options
author | Erik Johnston <erik@matrix.org> | 2022-09-30 13:15:32 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-09-30 13:15:32 +0100 |
commit | 3dfc4a08dc2e77178f2c2af68dc14b32da2d8b8f (patch) | |
tree | abde443255a515041f7c28e919601267edec2fdc /synapse/handlers | |
parent | Fix overflows in /messages backfill calculation (#13936) (diff) | |
download | synapse-3dfc4a08dc2e77178f2c2af68dc14b32da2d8b8f.tar.xz |
Fix performance regression in `get_users_in_room` (#13972)
Fixes #13942. Introduced in #13575. Basically, let's only get the ordered set of hosts out of the DB if we need an ordered set of hosts. Since we split the function up the caching won't be as good, but I think it will still be fine as e.g. multiple backfill requests for the same room will hit the cache.
Diffstat (limited to 'synapse/handlers')
-rw-r--r-- | synapse/handlers/federation.py | 4 | ||||
-rw-r--r-- | synapse/handlers/room.py | 4 |
2 files changed, 6 insertions, 2 deletions
diff --git a/synapse/handlers/federation.py b/synapse/handlers/federation.py index b866258298..986ffed3d5 100644 --- a/synapse/handlers/federation.py +++ b/synapse/handlers/federation.py @@ -412,7 +412,9 @@ class FederationHandler: # First we try hosts that are already in the room. # TODO: HEURISTIC ALERT. likely_domains = ( - await self._storage_controllers.state.get_current_hosts_in_room(room_id) + await self._storage_controllers.state.get_current_hosts_in_room_ordered( + room_id + ) ) async def try_backfill(domains: Collection[str]) -> bool: diff --git a/synapse/handlers/room.py b/synapse/handlers/room.py index b220238e55..57ab05ad25 100644 --- a/synapse/handlers/room.py +++ b/synapse/handlers/room.py @@ -1540,7 +1540,9 @@ class TimestampLookupHandler: ) likely_domains = ( - await self._storage_controllers.state.get_current_hosts_in_room(room_id) + await self._storage_controllers.state.get_current_hosts_in_room_ordered( + room_id + ) ) # Loop through each homeserver candidate until we get a succesful response |