Permalink
Browse files

fix(task) handle download progress corretly

  • Loading branch information...
fffonion committed Mar 19, 2018
1 parent b536fbc commit b395d3d0c669ae021a7fc37f0b4085d85d0087a7
Showing with 3 additions and 3 deletions.
  1. +3 −3 xeHentai/task.py
@@ -226,13 +226,13 @@ def save_file(self, imgurl, redirect_url, binary_iter):
except DownloadAbortedException as ex:
os.remove(fn_tmp)
return
self._cnt_lock.acquire()
self.meta['finished'] += 1
self._cnt_lock.release()
self._f_lock.acquire()
try:
os.rename(fn_tmp, fn)
self._cnt_lock.acquire()
self.meta['finished'] += 1
self._cnt_lock.release()
if imgurl in self.filehash_map:
for _fid, _ in self.filehash_map[imgurl]:
# if a file download is interrupted, it will appear in self.filehash_map as well

0 comments on commit b395d3d

Please sign in to comment.