summary refs log tree commit diff
path: root/synapse/app/synchrotron.py
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2016-06-07 15:45:56 +0100
committerErik Johnston <erik@matrix.org>2016-06-07 15:45:56 +0100
commitdded389ac16ec023c986df400d25ca94a4a28677 (patch)
tree3849482e45e1530169b80c91082f7b5bf5e07bb4 /synapse/app/synchrotron.py
parentMerge pull request #847 from matrix-org/erikj/gc_tick (diff)
downloadsynapse-dded389ac16ec023c986df400d25ca94a4a28677.tar.xz
Allow setting of gc.set_thresholds
Diffstat (limited to 'synapse/app/synchrotron.py')
-rw-r--r--synapse/app/synchrotron.py15
1 files changed, 10 insertions, 5 deletions
diff --git a/synapse/app/synchrotron.py b/synapse/app/synchrotron.py
index 5c552ffb29..f9673ab8d8 100644
--- a/synapse/app/synchrotron.py
+++ b/synapse/app/synchrotron.py
@@ -57,6 +57,7 @@ from daemonize import Daemonize
 import sys
 import logging
 import contextlib
+import gc
 import ujson as json
 
 logger = logging.getLogger("synapse.app.synchrotron")
@@ -484,6 +485,8 @@ def setup(config_options):
     ss.start_listening()
 
     change_resource_limit(ss.config.soft_file_limit)
+    if ss.config.gc_thresholds:
+        ss.set_threshold(*ss.config.gc_thresholds)
 
     def start():
         ss.get_datastore().start_profiling()
@@ -496,17 +499,19 @@ def setup(config_options):
 
 if __name__ == '__main__':
     with LoggingContext("main"):
-        ps = setup(sys.argv[1:])
+        ss = setup(sys.argv[1:])
 
-        if ps.config.daemonize:
+        if ss.config.daemonize:
             def run():
                 with LoggingContext("run"):
-                    change_resource_limit(ps.config.soft_file_limit)
+                    change_resource_limit(ss.config.soft_file_limit)
+                    if ss.config.gc_thresholds:
+                        gc.set_threshold(*ss.config.gc_thresholds)
                     reactor.run()
 
             daemon = Daemonize(
-                app="synapse-pusher",
-                pid=ps.config.pid_file,
+                app="synapse-synchrotron",
+                pid=ss.config.pid_file,
                 action=run,
                 auto_close_fds=False,
                 verbose=True,