Skip to content

Commit

Permalink
Retry 5xx errors in federation client (matrix-org#9567)
Browse files Browse the repository at this point in the history
  • Loading branch information
erikjohnston authored Mar 9, 2021
1 parent 7fdc6ce commit 9cd18cc
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
1 change: 1 addition & 0 deletions changelog.d/9567.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix bug where federation requests were not correctly retried on 5xx responses.
7 changes: 4 additions & 3 deletions synapse/http/matrixfederationclient.py
Original file line number Diff line number Diff line change
Expand Up @@ -534,9 +534,10 @@ async def _send_request(
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
Expand Down

0 comments on commit 9cd18cc

Please sign in to comment.