mirror of
https://github.com/soimort/you-get.git
synced 2025-02-10 12:12:26 +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():
|
def action_sort():
|
||||||
while not tasks.empty():
|
while not tasks.empty():
|
||||||
idx, params = tasks.get(block=False)
|
idx, params = tasks.get(block=False)
|
||||||
|
try:
|
||||||
result.put((idx, target(*params)))
|
result.put((idx, target(*params)))
|
||||||
|
except Exception as e:
|
||||||
|
logging.warn(str(e))
|
||||||
|
tasks.put((idx, params))
|
||||||
|
|
||||||
def action_not_sort():
|
def action_not_sort():
|
||||||
while not tasks.empty():
|
while not tasks.empty():
|
||||||
|
try:
|
||||||
params = tasks.get(block=False)
|
params = tasks.get(block=False)
|
||||||
result.put(target(*params))
|
result.put(target(*params))
|
||||||
|
except Exception as e:
|
||||||
|
logging.warn(str(e))
|
||||||
|
tasks.put(params)
|
||||||
|
|
||||||
def f():
|
def f():
|
||||||
try:
|
try:
|
||||||
|
Loading…
Reference in New Issue
Block a user