summary refs log tree commit diff
path: root/synapse/app/_base.py
diff options
context:
space:
mode:
authorErik Johnston <erikj@jki.re>2019-03-15 10:35:38 +0000
committerGitHub <noreply@github.com>2019-03-15 10:35:38 +0000
commitb0fa3f6ff3a84c66a2cd6b8e18413fe051ff257f (patch)
treeeda8410722f1f740778c723886d7abc33f8747d1 /synapse/app/_base.py
parentAdd systemd setup that supports workers (#4662) (diff)
parentCorrectly handle all command line options (diff)
downloadsynapse-b0fa3f6ff3a84c66a2cd6b8e18413fe051ff257f.tar.xz
Merge pull request #4853 from matrix-org/erikj/worker_docker_ci
Allow passing --daemonize to workers
Diffstat (limited to 'synapse/app/_base.py')
-rw-r--r--synapse/app/_base.py18
1 files changed, 12 insertions, 6 deletions
diff --git a/synapse/app/_base.py b/synapse/app/_base.py
index 32e8b8a3f5..d4c6c4c8e2 100644
--- a/synapse/app/_base.py
+++ b/synapse/app/_base.py
@@ -63,12 +63,13 @@ def start_worker_reactor(appname, config):
 
     start_reactor(
         appname,
-        config.soft_file_limit,
-        config.gc_thresholds,
-        config.worker_pid_file,
-        config.worker_daemonize,
-        config.worker_cpu_affinity,
-        logger,
+        soft_file_limit=config.soft_file_limit,
+        gc_thresholds=config.gc_thresholds,
+        pid_file=config.worker_pid_file,
+        daemonize=config.worker_daemonize,
+        cpu_affinity=config.worker_cpu_affinity,
+        print_pidfile=config.print_pidfile,
+        logger=logger,
     )
 
 
@@ -79,6 +80,7 @@ def start_reactor(
         pid_file,
         daemonize,
         cpu_affinity,
+        print_pidfile,
         logger,
 ):
     """ Run the reactor in the main process
@@ -93,6 +95,7 @@ def start_reactor(
         pid_file (str): name of pid file to write to if daemonize is True
         daemonize (bool): true to run the reactor in a background process
         cpu_affinity (int|None): cpu affinity mask
+        print_pidfile (bool): whether to print the pid file, if daemonize is True
         logger (logging.Logger): logger instance to pass to Daemonize
     """
 
@@ -124,6 +127,9 @@ def start_reactor(
             reactor.run()
 
     if daemonize:
+        if print_pidfile:
+            print(pid_file)
+
         daemon = Daemonize(
             app=appname,
             pid=pid_file,