From 75ec773a6f9033951a2a548a3b0276d25c431a72 Mon Sep 17 00:00:00 2001
From: kornpisey
Date: Mon, 30 May 2022 13:50:23 +0900
Subject: [PATCH] fix bug forever retry when request url error
---
github_backup/github_backup.py | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/github_backup/github_backup.py b/github_backup/github_backup.py
index 873a40c..371917b 100644
--- a/github_backup/github_backup.py
+++ b/github_backup/github_backup.py
@@ -533,12 +533,12 @@ def _get_response(request, auth, template):
r = exc
except URLError as e:
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:
raise
except socket.error as e:
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:
raise
@@ -598,16 +598,15 @@ def _request_http_error(exc, auth, errors):
def _request_url_error(template, retry_timeout):
- # Incase of a connection timing out, we can retry a few time
+ # In case of a connection timing out, we can retry a few time
# But we won't crash and not back-up the rest now
log_info('{} timed out'.format(template))
retry_timeout -= 1
if retry_timeout >= 0:
- return True
+ return True, retry_timeout
raise Exception('{} timed out to much, skipping!')
- return False
class S3HTTPRedirectHandler(HTTPRedirectHandler):