mirror of
https://github.com/tuna/tunasync-scripts.git
synced 2025-04-20 12:42:50 +00:00
call task_done() anyway
This commit is contained in:
parent
905940b302
commit
063b349ea1
@ -2,6 +2,7 @@
|
||||
import os
|
||||
import threading
|
||||
import queue
|
||||
import traceback
|
||||
from pathlib import Path
|
||||
from email.utils import parsedate_to_datetime
|
||||
|
||||
@ -98,6 +99,7 @@ def downloading_worker(q):
|
||||
if item is None:
|
||||
break
|
||||
|
||||
try:
|
||||
url, dst_file, working_dir = item
|
||||
if dst_file.is_file():
|
||||
print("checking", url, flush=True)
|
||||
@ -110,19 +112,17 @@ def downloading_worker(q):
|
||||
|
||||
if remote_filesize == local_filesize and remote_date.timestamp() == local_mtime:
|
||||
print("skipping", dst_file.relative_to(working_dir), flush=True)
|
||||
q.task_done()
|
||||
continue
|
||||
|
||||
dst_file.unlink()
|
||||
|
||||
print("downloading", url, flush=True)
|
||||
try:
|
||||
requests_download(url, dst_file)
|
||||
except Exception:
|
||||
traceback.print_exc()
|
||||
print("Failed to download", url, flush=True)
|
||||
if dst_file.is_file():
|
||||
dst_file.unlink()
|
||||
|
||||
finally:
|
||||
q.task_done()
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user