Commit ca404933 authored by Martino Bertoni's avatar Martino Bertoni 🌋
Browse files

hopefully less randomly failing downloader unit test

parent 5c80b60b
Pipeline #2590 passed with stages
in 76 minutes and 11 seconds
......@@ -51,7 +51,20 @@ class Downloader():
# validating url
parsed = urlparse(url)
if parsed.scheme == 'ftp':
f = FTP(parsed.netloc)
attempts = 0
connected = False
while attempts < 5:
try:
f = FTP(parsed.netloc)
connected = True
break
except Exception as err:
attempts += 1
Downloader.__log.warning('Attempt failed: %s', str(err))
request.urlcleanup()
sleep(5)
if not connected:
raise Exception('All attempts to connect failed.')
f.login()
files = f.nlst(parsed.path)
if len(files) > 1:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment