mirror of
https://github.com/openSUSE/osc.git
synced 2024-11-11 07:06:16 +01:00
Merge pull request #1260 from dmach/connection-retry-backoff_factor
connection: Wait between retries
This commit is contained in:
commit
7fec5c8c25
@ -1,5 +1,6 @@
|
||||
import base64
|
||||
import fcntl
|
||||
import inspect
|
||||
import os
|
||||
import re
|
||||
import shutil
|
||||
@ -217,7 +218,20 @@ def http_request(method: str, url: str, headers=None, data=None, file=None):
|
||||
pool = CONNECTION_POOLS.get(apiurl, None)
|
||||
if not pool:
|
||||
pool_kwargs = {}
|
||||
pool_kwargs["retries"] = urllib3.Retry(total=int(conf.config["http_retries"]))
|
||||
|
||||
# urllib3.Retry() argument 'method_whitelist' got renamed to 'allowed_methods'
|
||||
sig = inspect.signature(urllib3.Retry)
|
||||
arg_names = list(sig.parameters.keys())
|
||||
if "allowed_methods" in arg_names:
|
||||
retries_kwargs = {"allowed_methods": None}
|
||||
else:
|
||||
retries_kwargs = {"method_whitelist": None}
|
||||
|
||||
pool_kwargs["retries"] = urllib3.Retry(
|
||||
total=int(conf.config["http_retries"]),
|
||||
backoff_factor=2,
|
||||
**retries_kwargs,
|
||||
)
|
||||
|
||||
if purl.scheme == "https":
|
||||
ssl_context = oscssl.create_ssl_context()
|
||||
|
Loading…
Reference in New Issue
Block a user