Abilty to disable file bad file retry at end of download

This commit is contained in:
shortcutme 2019-12-21 03:03:32 +01:00
parent c5de1447c8
commit 7c1da5da52
No known key found for this signature in database
GPG key ID: 5B63BAE6CB9613AE

View file

@ -326,15 +326,15 @@ class Site(object):
# Download all files of the site # Download all files of the site
@util.Noparallel(blocking=False) @util.Noparallel(blocking=False)
def download(self, check_size=False, blind_includes=False): def download(self, check_size=False, blind_includes=False, retry_bad_files=True):
if not self.connection_server: if not self.connection_server:
self.log.debug("No connection server found, skipping download") self.log.debug("No connection server found, skipping download")
return False return False
s = time.time() s = time.time()
self.log.debug( self.log.debug(
"Start downloading, bad_files: %s, check_size: %s, blind_includes: %s" % "Start downloading, bad_files: %s, check_size: %s, blind_includes: %s, called by: %s" %
(self.bad_files, check_size, blind_includes) (self.bad_files, check_size, blind_includes, Debug.formatStack())
) )
gevent.spawn(self.announce, force=True) gevent.spawn(self.announce, force=True)
if check_size: # Check the size first if check_size: # Check the size first
@ -345,8 +345,9 @@ class Site(object):
# Download everything # Download everything
valid = self.downloadContent("content.json", check_modifications=blind_includes) valid = self.downloadContent("content.json", check_modifications=blind_includes)
self.onComplete.once(lambda: self.retryBadFiles(force=True)) if retry_bad_files:
self.log.debug("Download done in %.3fs" % (time.time () - s)) self.onComplete.once(lambda: self.retryBadFiles(force=True))
self.log.debug("Download done in %.3fs" % (time.time() - s))
return valid return valid