summary refs log tree commit diff
path: root/synapse/app/_base.py
diff options
context:
space:
mode:
authorreivilibre <oliverw@matrix.org>2022-06-30 12:58:12 +0100
committerGitHub <noreply@github.com>2022-06-30 11:58:12 +0000
commit9667bad55d8b50fe08990a8cfd2ac82c8540bcc1 (patch)
tree663c46095087d83481f7e459ed1d6f7f5ecd5105 /synapse/app/_base.py
parentActually typecheck `tests.test_server` (#13135) (diff)
downloadsynapse-9667bad55d8b50fe08990a8cfd2ac82c8540bcc1.tar.xz
Improve startup times in Complement test runs against workers, particularly in CPU-constrained environments. (#13127)
Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>
Diffstat (limited to 'synapse/app/_base.py')
-rw-r--r--synapse/app/_base.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/synapse/app/_base.py b/synapse/app/_base.py
index 363ac98ea9..923891ae0d 100644
--- a/synapse/app/_base.py
+++ b/synapse/app/_base.py
@@ -106,7 +106,9 @@ def register_sighup(func: Callable[P, None], *args: P.args, **kwargs: P.kwargs)
 def start_worker_reactor(
     appname: str,
     config: HomeServerConfig,
-    run_command: Callable[[], None] = reactor.run,
+    # Use a lambda to avoid binding to a given reactor at import time.
+    # (needed when synapse.app.complement_fork_starter is being used)
+    run_command: Callable[[], None] = lambda: reactor.run(),
 ) -> None:
     """Run the reactor in the main process
 
@@ -141,7 +143,9 @@ def start_reactor(
     daemonize: bool,
     print_pidfile: bool,
     logger: logging.Logger,
-    run_command: Callable[[], None] = reactor.run,
+    # Use a lambda to avoid binding to a given reactor at import time.
+    # (needed when synapse.app.complement_fork_starter is being used)
+    run_command: Callable[[], None] = lambda: reactor.run(),
 ) -> None:
     """Run the reactor in the main process