summary refs log tree commit diff
path: root/synapse
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2021-03-09 13:15:12 +0000
committerGitHub <noreply@github.com>2021-03-09 13:15:12 +0000
commit9cd18cc5886a5f44625c1c4730f146ec189b833e (patch)
tree64727878a2001a5f9ed045e1f66da1276fbc020c /synapse
parentFix additional type hints. (#9543) (diff)
downloadsynapse-9cd18cc5886a5f44625c1c4730f146ec189b833e.tar.xz
Retry 5xx errors in federation client (#9567)
Fixes #8915
Diffstat (limited to 'synapse')
-rw-r--r--synapse/http/matrixfederationclient.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/synapse/http/matrixfederationclient.py b/synapse/http/matrixfederationclient.py
index da6866addf..5f01ebd3d4 100644
--- a/synapse/http/matrixfederationclient.py
+++ b/synapse/http/matrixfederationclient.py
@@ -534,9 +534,10 @@ class MatrixFederationHttpClient:
                             response.code, response_phrase, body
                         )
 
-                        # Retry if the error is a 429 (Too Many Requests),
-                        # otherwise just raise a standard HttpResponseException
-                        if response.code == 429:
+                        # Retry if the error is a 5xx or a 429 (Too Many
+                        # Requests), otherwise just raise a standard
+                        # `HttpResponseException`
+                        if 500 <= response.code < 600 or response.code == 429:
                             raise RequestSendFailed(exc, can_retry=True) from exc
                         else:
                             raise exc