Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Retry 5xx errors in federation client #9567

Merged
merged 2 commits into from Mar 9, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/9567.bugfix
@@ -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
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