diff options
author | Erik Johnston <erik@matrix.org> | 2016-06-08 10:50:31 +0100 |
---|---|---|
committer | Erik Johnston <erik@matrix.org> | 2016-06-08 10:50:31 +0100 |
commit | 5c7311515537832fcc462cc857316d62c36ee54d (patch) | |
tree | 715ef91066fd1c785cab632257063365835c9b58 /synapse/app/pusher.py | |
parent | Note that v0.15.x was never released (diff) | |
parent | Merge pull request #850 from matrix-org/erikj/gc_threshold (diff) | |
download | synapse-5c7311515537832fcc462cc857316d62c36ee54d.tar.xz |
Merge branch 'develop' of github.com:matrix-org/synapse into release-v0.16.0
Diffstat (limited to 'synapse/app/pusher.py')
-rw-r--r-- | synapse/app/pusher.py | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/synapse/app/pusher.py b/synapse/app/pusher.py index f1de1e7ce9..4ec23d84c1 100644 --- a/synapse/app/pusher.py +++ b/synapse/app/pusher.py @@ -43,6 +43,7 @@ from twisted.web.resource import Resource from daemonize import Daemonize +import gc import sys import logging @@ -64,6 +65,20 @@ class SlaveConfig(DatabaseConfig): self.pid_file = self.abspath(config.get("pid_file")) self.public_baseurl = config["public_baseurl"] + thresholds = config.get("gc_thresholds", None) + if thresholds is not None: + try: + assert len(thresholds) == 3 + self.gc_thresholds = ( + int(thresholds[0]), int(thresholds[1]), int(thresholds[2]), + ) + except: + raise ConfigError( + "Value of `gc_threshold` must be a list of three integers if set" + ) + else: + self.gc_thresholds = None + # some things used by the auth handler but not actually used in the # pusher codebase self.bcrypt_rounds = None @@ -311,7 +326,7 @@ class PusherServer(HomeServer): poke_pushers(result) except: logger.exception("Error replicating from %r", replication_url) - sleep(30) + yield sleep(30) def setup(config_options): @@ -342,6 +357,8 @@ def setup(config_options): ps.start_listening() change_resource_limit(ps.config.soft_file_limit) + if ps.config.gc_thresholds: + gc.set_threshold(*ps.config.gc_thresholds) def start(): ps.replicate() @@ -361,6 +378,8 @@ if __name__ == '__main__': def run(): with LoggingContext("run"): change_resource_limit(ps.config.soft_file_limit) + if ps.config.gc_thresholds: + gc.set_threshold(*ps.config.gc_thresholds) reactor.run() daemon = Daemonize( |