Skip to content

Commit

Permalink
Retry download if closed connection without response. Add exception type
Browse files Browse the repository at this point in the history
  • Loading branch information
CostanzoPablo committed Oct 14, 2020
1 parent e556421 commit 39d6cf4
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions audiomate/corpus/io/voxforge.py
Expand Up @@ -2,6 +2,7 @@
import re
import tarfile
import shutil
import time

import requests

Expand Down Expand Up @@ -93,8 +94,8 @@ def download_files(self, file_urls, target_path):
while True:
try:
dl_result = download.download_files(url_to_target, num_threads=self.num_workers)
except:
logger.info('Failed to download file. Remote end closed connection without response. Trying again in 5 seconds...')
except ConnectionError as e:
logger.info('Remote end closed connection without response. Trying again in 5 seconds...', e)
time.sleep(5)
continue
break
Expand Down

0 comments on commit 39d6cf4

Please sign in to comment.