Permalink
Browse files

fix(task) handle download progress corretly

  • Loading branch information...
fffonion committed Mar 19, 2018
1 parent 768c909 commit eea87abef9a4320a75397f7e5d587c98a0f03893
Showing with 3 additions and 3 deletions.
  1. +3 −3 xeHentai/task.py
View
@@ -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 eea87ab

Please sign in to comment.