summary refs log tree commit diff
path: root/synapse/config/federation.py
diff options
context:
space:
mode:
authorMathieu Velten <mathieuv@matrix.org>2023-06-21 10:41:11 +0200
committerGitHub <noreply@github.com>2023-06-21 10:41:11 +0200
commit496f73103df838795b0e98f8c1c7337468e41abc (patch)
treeec6d75dbb2b449420ffc5cbde0591c76fefc166c /synapse/config/federation.py
parentMerge branch 'master' into develop (diff)
downloadsynapse-496f73103df838795b0e98f8c1c7337468e41abc.tar.xz
Allow for the configuration of max request retries and min/max retry delays in the matrix federation client (#15783)
Diffstat (limited to 'synapse/config/federation.py')
-rw-r--r--synapse/config/federation.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/synapse/config/federation.py b/synapse/config/federation.py
index 336fca578a..0e1cb8b6e3 100644
--- a/synapse/config/federation.py
+++ b/synapse/config/federation.py
@@ -22,6 +22,8 @@ class FederationConfig(Config):
     section = "federation"
 
     def read_config(self, config: JsonDict, **kwargs: Any) -> None:
+        federation_config = config.setdefault("federation", {})
+
         # FIXME: federation_domain_whitelist needs sytests
         self.federation_domain_whitelist: Optional[dict] = None
         federation_domain_whitelist = config.get("federation_domain_whitelist", None)
@@ -49,5 +51,19 @@ class FederationConfig(Config):
             "allow_device_name_lookup_over_federation", False
         )
 
+        # Allow for the configuration of timeout, max request retries
+        # and min/max retry delays in the matrix federation client.
+        self.client_timeout_ms = Config.parse_duration(
+            federation_config.get("client_timeout", "60s")
+        )
+        self.max_long_retry_delay_ms = Config.parse_duration(
+            federation_config.get("max_long_retry_delay", "60s")
+        )
+        self.max_short_retry_delay_ms = Config.parse_duration(
+            federation_config.get("max_short_retry_delay", "2s")
+        )
+        self.max_long_retries = federation_config.get("max_long_retries", 10)
+        self.max_short_retries = federation_config.get("max_short_retries", 3)
+
 
 _METRICS_FOR_DOMAINS_SCHEMA = {"type": "array", "items": {"type": "string"}}