summary refs log tree commit diff
path: root/synapse/config/server.py
diff options
context:
space:
mode:
authorMark Haines <mark.haines@matrix.org>2016-06-16 11:06:12 +0100
committerMark Haines <mark.haines@matrix.org>2016-06-16 11:06:12 +0100
commit885ee861f7270fef1370a2d63e009a8fceaf8dd5 (patch)
treee8a12c137cec49dec4fea35ab424a3c6fdf92aaa /synapse/config/server.py
parentMerge pull request #866 from bartekrutkowski/develop (diff)
downloadsynapse-885ee861f7270fef1370a2d63e009a8fceaf8dd5.tar.xz
Inline the synchrotron and pusher configs into the main config
Diffstat (limited to 'synapse/config/server.py')
-rw-r--r--synapse/config/server.py31
1 files changed, 18 insertions, 13 deletions
diff --git a/synapse/config/server.py b/synapse/config/server.py

index 44b8d422e0..f370b22c32 100644 --- a/synapse/config/server.py +++ b/synapse/config/server.py
@@ -38,19 +38,7 @@ class ServerConfig(Config): self.listeners = config.get("listeners", []) - 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 + self.gc_thresholds = read_gc_thresholds(config.get("gc_thresholds", None)) bind_port = config.get("bind_port") if bind_port: @@ -264,3 +252,20 @@ class ServerConfig(Config): type=int, help="Turn on the twisted telnet manhole" " service on the given port.") + + +def read_gc_thresholds(thresholds): + """Reads the three integer thresholds for garbage collection. Ensures that + the thresholds are integers if thresholds are supplied. + """ + if thresholds is None: + return None + try: + assert len(thresholds) == 3 + return ( + 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" + )