1
0
mirror of https://github.com/openSUSE/osc.git synced 2025-08-06 23:53:39 +02:00

Merge pull request #1306 from dmach/connection-retry-on-errors

Retry on receiving the following HTTP status codes: 400, 500, 502, 503, 504
This commit is contained in:
2023-04-27 11:31:56 +02:00
committed by GitHub

View File

@@ -230,6 +230,15 @@ def http_request(method: str, url: str, headers=None, data=None, file=None):
pool_kwargs["retries"] = urllib3.Retry(
total=int(conf.config["http_retries"]),
backoff_factor=2,
status_forcelist=(
400, # Bad Request; retry on 400: service in progress
500, # Internal Server Error
502, # Bad Gateway
503, # Service Unavailable
504, # Gateway Timeout
),
# don't raise because we want an actual response rather than a MaxRetryError with "too many <status_code> error responses" message
raise_on_status=False,
**retries_kwargs,
)