mirror of
https://github.com/soimort/you-get.git
synced 2025-02-09 03:37:52 +03:00
catch errors in multiple threads and retry
This commit is contained in:
parent
c8eef8fb0b
commit
c83ca1fc07
@ -530,12 +530,20 @@ def parallel_in_thread(target, params_list, sort, **kwargs):
|
||||
def action_sort():
|
||||
while not tasks.empty():
|
||||
idx, params = tasks.get(block=False)
|
||||
result.put((idx, target(*params)))
|
||||
try:
|
||||
result.put((idx, target(*params)))
|
||||
except Exception as e:
|
||||
logging.warn(str(e))
|
||||
tasks.put((idx, params))
|
||||
|
||||
def action_not_sort():
|
||||
while not tasks.empty():
|
||||
params = tasks.get(block=False)
|
||||
result.put(target(*params))
|
||||
try:
|
||||
params = tasks.get(block=False)
|
||||
result.put(target(*params))
|
||||
except Exception as e:
|
||||
logging.warn(str(e))
|
||||
tasks.put(params)
|
||||
|
||||
def f():
|
||||
try:
|
||||
|
Loading…
Reference in New Issue
Block a user