1
0
mirror of https://github.com/openSUSE/osc.git synced 2025-02-24 03:02:12 +01: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:
Daniel Mach 2023-04-27 11:31:56 +02:00 committed by GitHub
commit 6d5493130e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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,
)