diff --git a/rhodecode/integrations/types/webhook.py b/rhodecode/integrations/types/webhook.py --- a/rhodecode/integrations/types/webhook.py +++ b/rhodecode/integrations/types/webhook.py @@ -255,14 +255,13 @@ class WebhookIntegrationType(Integration @task(ignore_result=True) def post_to_webhook(url_calls, settings): max_retries = 3 + retries = Retry( + total=max_retries, + backoff_factor=0.15, + status_forcelist=[500, 502, 503, 504]) for url, token, data in url_calls: - # retry max N times - retries = Retry( - total=max_retries, - backoff_factor=0.15, - status_forcelist=[500, 502, 503, 504]) req_session = requests.Session() - req_session.mount( + req_session.mount( # retry max N times 'http://', requests.adapters.HTTPAdapter(max_retries=retries)) method = settings.get('method_type') or 'post' diff --git a/rhodecode/lib/vcs/client_http.py b/rhodecode/lib/vcs/client_http.py --- a/rhodecode/lib/vcs/client_http.py +++ b/rhodecode/lib/vcs/client_http.py @@ -32,6 +32,7 @@ import uuid import pycurl import msgpack import requests +from requests.packages.urllib3.util.retry import Retry from . import exceptions, CurlSession @@ -232,7 +233,11 @@ class VcsHttpProxy(object): CHUNK_SIZE = 16384 def __init__(self, server_and_port, backend_endpoint): - adapter = requests.adapters.HTTPAdapter(max_retries=5) + + + retries = Retry(total=5, connect=None, read=None, redirect=None) + + adapter = requests.adapters.HTTPAdapter(max_retries=retries) self.base_url = urlparse.urljoin( 'http://%s' % server_and_port, backend_endpoint) self.session = requests.Session()