Skip to content

Commit 75ec773

Browse files
author
kornpisey
committed
fix bug forever retry when request url error
1 parent 63441eb commit 75ec773

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

github_backup/github_backup.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -533,12 +533,12 @@ def _get_response(request, auth, template):
533533
r = exc
534534
except URLError as e:
535535
log_warning(e.reason)
536-
should_continue = _request_url_error(template, retry_timeout)
536+
should_continue, retry_timeout = _request_url_error(template, retry_timeout)
537537
if not should_continue:
538538
raise
539539
except socket.error as e:
540540
log_warning(e.strerror)
541-
should_continue = _request_url_error(template, retry_timeout)
541+
should_continue, retry_timeout = _request_url_error(template, retry_timeout)
542542
if not should_continue:
543543
raise
544544

@@ -598,16 +598,15 @@ def _request_http_error(exc, auth, errors):
598598

599599

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

606606
if retry_timeout >= 0:
607-
return True
607+
return True, retry_timeout
608608

609609
raise Exception('{} timed out to much, skipping!')
610-
return False
611610

612611

613612
class S3HTTPRedirectHandler(HTTPRedirectHandler):

0 commit comments

Comments
 (0)