Merge pull request #201 from TRAdEWORKS/fix-bug-request-url-error-forever-retry

Fix a bug forever retry when request url error
This commit is contained in:
josegonzalez
2022-11-28 00:22:54 -05:00
committed by GitHub

View File

@@ -537,12 +537,12 @@ def _get_response(request, auth, template):
r = exc r = exc
except URLError as e: except URLError as e:
log_warning(e.reason) log_warning(e.reason)
should_continue = _request_url_error(template, retry_timeout) should_continue, retry_timeout = _request_url_error(template, retry_timeout)
if not should_continue: if not should_continue:
raise raise
except socket.error as e: except socket.error as e:
log_warning(e.strerror) log_warning(e.strerror)
should_continue = _request_url_error(template, retry_timeout) should_continue, retry_timeout = _request_url_error(template, retry_timeout)
if not should_continue: if not should_continue:
raise raise
@@ -608,10 +608,9 @@ def _request_url_error(template, retry_timeout):
retry_timeout -= 1 retry_timeout -= 1
if retry_timeout >= 0: if retry_timeout >= 0:
return True return True, retry_timeout
raise Exception('{} timed out to much, skipping!') raise Exception('{} timed out to much, skipping!')
return False
class S3HTTPRedirectHandler(HTTPRedirectHandler): class S3HTTPRedirectHandler(HTTPRedirectHandler):