summary refs log tree commit diff
path: root/synapse/config/server.py
diff options
context:
space:
mode:
authorMark Haines <mjark@negativecurvature.net>2016-06-17 10:58:52 +0100
committerGitHub <noreply@github.com>2016-06-17 10:58:52 +0100
commitf1073ad43d04dfbdc12474a4d4ccc1be3617fa77 (patch)
treed519760f3b97d578c741d5062223189157285a99 /synapse/config/server.py
parentMerge pull request #873 from vt0r/bugfix/bcrypt-utf8-encode (diff)
parentUse worker_ prefixes for worker config, use existing support for multiple con... (diff)
downloadsynapse-f1073ad43d04dfbdc12474a4d4ccc1be3617fa77.tar.xz
Merge pull request #874 from matrix-org/markjh/worker_config
Inline the synchrotron and pusher configs into the main config
Diffstat (limited to '')
-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"
+        )