##// END OF EJS Templates
http: ported old depracated retry format for http client.
marcink -
r1958:7ffffec9 default
parent child Browse files
Show More
@@ -255,14 +255,13 b' class WebhookIntegrationType(Integration'
255 @task(ignore_result=True)
255 @task(ignore_result=True)
256 def post_to_webhook(url_calls, settings):
256 def post_to_webhook(url_calls, settings):
257 max_retries = 3
257 max_retries = 3
258 for url, token, data in url_calls:
259 # retry max N times
260 retries = Retry(
258 retries = Retry(
261 total=max_retries,
259 total=max_retries,
262 backoff_factor=0.15,
260 backoff_factor=0.15,
263 status_forcelist=[500, 502, 503, 504])
261 status_forcelist=[500, 502, 503, 504])
262 for url, token, data in url_calls:
264 req_session = requests.Session()
263 req_session = requests.Session()
265 req_session.mount(
264 req_session.mount( # retry max N times
266 'http://', requests.adapters.HTTPAdapter(max_retries=retries))
265 'http://', requests.adapters.HTTPAdapter(max_retries=retries))
267
266
268 method = settings.get('method_type') or 'post'
267 method = settings.get('method_type') or 'post'
@@ -32,6 +32,7 b' import uuid'
32 import pycurl
32 import pycurl
33 import msgpack
33 import msgpack
34 import requests
34 import requests
35 from requests.packages.urllib3.util.retry import Retry
35
36
36 from . import exceptions, CurlSession
37 from . import exceptions, CurlSession
37
38
@@ -232,7 +233,11 b' class VcsHttpProxy(object):'
232 CHUNK_SIZE = 16384
233 CHUNK_SIZE = 16384
233
234
234 def __init__(self, server_and_port, backend_endpoint):
235 def __init__(self, server_and_port, backend_endpoint):
235 adapter = requests.adapters.HTTPAdapter(max_retries=5)
236
237
238 retries = Retry(total=5, connect=None, read=None, redirect=None)
239
240 adapter = requests.adapters.HTTPAdapter(max_retries=retries)
236 self.base_url = urlparse.urljoin(
241 self.base_url = urlparse.urljoin(
237 'http://%s' % server_and_port, backend_endpoint)
242 'http://%s' % server_and_port, backend_endpoint)
238 self.session = requests.Session()
243 self.session = requests.Session()
General Comments 0
You need to be logged in to leave comments. Login now