summary refs log tree commit diff
path: root/tests/events/test_presence_router.py
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2021-07-15 11:52:56 +0100
committerGitHub <noreply@github.com>2021-07-15 11:52:56 +0100
commitac5c221208ceb499cf8e9305b03efe1765ba48f6 (patch)
tree908bca4aabf97494ecee65b29f938f02a17f4f12 /tests/events/test_presence_router.py
parentUpdate the logcontext doc (#10353) (diff)
downloadsynapse-ac5c221208ceb499cf8e9305b03efe1765ba48f6.tar.xz
Stagger send presence to remotes (#10398)
This is to help with performance, where trying to connect to thousands
of hosts at once can consume a lot of CPU (due to TLS etc).

Co-authored-by: Brendan Abolivier <babolivier@matrix.org>
Diffstat (limited to 'tests/events/test_presence_router.py')
-rw-r--r--tests/events/test_presence_router.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/events/test_presence_router.py b/tests/events/test_presence_router.py
index c4ad33194d..3f41e99950 100644
--- a/tests/events/test_presence_router.py
+++ b/tests/events/test_presence_router.py
@@ -285,6 +285,10 @@ class PresenceRouterTestCase(FederatingHomeserverTestCase):
         presence_updates, _ = sync_presence(self, self.presence_receiving_user_two_id)
         self.assertEqual(len(presence_updates), 3)
 
+        # We stagger sending of presence, so we need to wait a bit for them to
+        # get sent out.
+        self.reactor.advance(60)
+
         # Test that sending to a remote user works
         remote_user_id = "@far_away_person:island"
 
@@ -301,6 +305,10 @@ class PresenceRouterTestCase(FederatingHomeserverTestCase):
             self.module_api.send_local_online_presence_to([remote_user_id])
         )
 
+        # We stagger sending of presence, so we need to wait a bit for them to
+        # get sent out.
+        self.reactor.advance(60)
+
         # Check that the expected presence updates were sent
         # We explicitly compare using sets as we expect that calling
         # module_api.send_local_online_presence_to will create a presence