0
0
Fork 1
mirror of https://mau.dev/maunium/synapse.git synced 2024-06-03 11:18:56 +02:00

Retry 5xx errors in federation client (#9567)

Fixes #8915
This commit is contained in:
Erik Johnston 2021-03-09 13:15:12 +00:00 committed by GitHub
parent 7fdc6cefb3
commit 9cd18cc588
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 3 deletions

1
changelog.d/9567.bugfix Normal file
View file

@ -0,0 +1 @@
Fix bug where federation requests were not correctly retried on 5xx responses.

View file

@ -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