summary refs log tree commit diff
path: root/synapse/config
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/config
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/config')
-rw-r--r--synapse/config/server.py19
1 files changed, 18 insertions, 1 deletions
diff --git a/synapse/config/server.py b/synapse/config/server.py
index c2d8f8a52f..44b8d422e0 100644
--- a/synapse/config/server.py
+++ b/synapse/config/server.py
@@ -13,7 +13,7 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-from ._base import Config
+from ._base import Config, ConfigError
 
 
 class ServerConfig(Config):
@@ -38,6 +38,20 @@ 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
+
         bind_port = config.get("bind_port")
         if bind_port:
             self.listeners = []
@@ -157,6 +171,9 @@ class ServerConfig(Config):
         # hard limit.
         soft_file_limit: 0
 
+        # The GC threshold parameters to pass to `gc.set_threshold`, if defined
+        # gc_thresholds: [700, 10, 10]
+
         # A list of other Home Servers to fetch the public room directory from
         # and include in the public room directory of this home server
         # This is a temporary stopgap solution to populate new server with a