Skip to content

Commit 38692bc

Browse files
authored
Merge pull request #201 from TRAdEWORKS/fix-bug-request-url-error-forever-retry
Fix a bug forever retry when request url error
2 parents 81362e5 + 75ec773 commit 38692bc

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

github_backup/github_backup.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -537,12 +537,12 @@ def _get_response(request, auth, template):
537537
r = exc
538538
except URLError as e:
539539
log_warning(e.reason)
540-
should_continue = _request_url_error(template, retry_timeout)
540+
should_continue, retry_timeout = _request_url_error(template, retry_timeout)
541541
if not should_continue:
542542
raise
543543
except socket.error as e:
544544
log_warning(e.strerror)
545-
should_continue = _request_url_error(template, retry_timeout)
545+
should_continue, retry_timeout = _request_url_error(template, retry_timeout)
546546
if not should_continue:
547547
raise
548548

@@ -602,16 +602,15 @@ def _request_http_error(exc, auth, errors):
602602

603603

604604
def _request_url_error(template, retry_timeout):
605-
# Incase of a connection timing out, we can retry a few time
605+
# In case of a connection timing out, we can retry a few time
606606
# But we won't crash and not back-up the rest now
607607
log_info('{} timed out'.format(template))
608608
retry_timeout -= 1
609609

610610
if retry_timeout >= 0:
611-
return True
611+
return True, retry_timeout
612612

613613
raise Exception('{} timed out to much, skipping!')
614-
return False
615614

616615

617616
class S3HTTPRedirectHandler(HTTPRedirectHandler):

0 commit comments

Comments
 (0)