Skip to content

Commit

Permalink
Merge pull request #2276 from Zilliqa/zil-1672-fix-download-missing
Browse files Browse the repository at this point in the history
[release-6.4] Fix missing download file in case of connection reset by peer
  • Loading branch information
ansnunez committed Oct 6, 2020
2 parents 2b75039 + 6782299 commit e6d89e3
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion scripts/download_incr_DB.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,17 @@ def GetAllObjectsFromS3(url, folderName=""):
def GetPersistenceKey(key_url):
retry_counter = 0
while True:
response = requests.get(key_url, stream=True)
try:
response = requests.get(key_url, stream=True)
except Exception as e:
print("Exception occurred while downloading " + key_url + ": " + str(e))
retry_counter+=1
if retry_counter > 3:
print("Failed to download: " + key_url)
break
time.sleep(5)
print("[Retry: " + str(retry_counter) + "] Downloading again " + key_url)
continue
if response.status_code != 200:
break
filename = key_url.replace(key_url[:key_url.index(TESTNET_NAME+"/")+len(TESTNET_NAME+"/")],"").strip()
Expand Down

0 comments on commit e6d89e3

Please sign in to comment.