Small bugfix for ftp crawler

This commit is contained in:
Simon 2018-06-20 21:56:38 -04:00
parent 4ca56d2317
commit dd93d40a55

View File

@ -36,14 +36,13 @@ class FtpDirectory(RemoteDirectory):
break break
except ftputil.error.FTPError as e: except ftputil.error.FTPError as e:
if e.errno == 530: if e.errno == 530 or e.errno == 421:
print("Cancel connection - too many connections") print("Cancel connection - too many connections")
break break
failed_attempts += 1 failed_attempts += 1
print("Connection error; reconnecting..." + e.strerror + " " + str(e.errno)) print("Connection error; reconnecting..." + e.strerror + " " + str(e.errno))
time.sleep(2 * random.uniform(0.5, 1.5)) time.sleep(2 * random.uniform(0.5, 1.5))
self.stop_when_connected()
def list_dir(self, path) -> list: def list_dir(self, path) -> list:
if not self.ftp: if not self.ftp: