summary refs log tree commit diff
path: root/tests/federation
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2022-06-06 18:46:11 +0300
committerGitHub <noreply@github.com>2022-06-06 16:46:11 +0100
commit44de53bb79f961147386ea2a8bfbeb54b007cd41 (patch)
tree69b9b7896e2f69518bebcdd579619099888be9b4 /tests/federation
parentDo not break URL previews if an image is unreachable. (#12950) (diff)
downloadsynapse-44de53bb79f961147386ea2a8bfbeb54b007cd41.tar.xz
Reduce state pulled from DB due to sending typing and receipts over federation (#12964)
Reducing the amount of state we pull from the DB is useful as fetching state is expensive in terms of DB, CPU and memory.
Diffstat (limited to 'tests/federation')
-rw-r--r--tests/federation/test_federation_sender.py14
1 files changed, 7 insertions, 7 deletions
diff --git a/tests/federation/test_federation_sender.py b/tests/federation/test_federation_sender.py
index b5be727fe4..01a1db6115 100644
--- a/tests/federation/test_federation_sender.py
+++ b/tests/federation/test_federation_sender.py
@@ -30,16 +30,16 @@ from tests.unittest import HomeserverTestCase, override_config
 
 class FederationSenderReceiptsTestCases(HomeserverTestCase):
     def make_homeserver(self, reactor, clock):
-        mock_state_handler = Mock(spec=["get_current_hosts_in_room"])
-        # Ensure a new Awaitable is created for each call.
-        mock_state_handler.get_current_hosts_in_room.return_value = make_awaitable(
-            ["test", "host2"]
-        )
-        return self.setup_test_homeserver(
-            state_handler=mock_state_handler,
+        hs = self.setup_test_homeserver(
             federation_transport_client=Mock(spec=["send_transaction"]),
         )
 
+        hs.get_storage_controllers().state.get_current_hosts_in_room = Mock(
+            return_value=make_awaitable({"test", "host2"})
+        )
+
+        return hs
+
     @override_config({"send_federation": True})
     def test_send_receipts(self):
         mock_send_transaction = (