mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-09-05 18:39:37 +02:00
[fragment] Handle errors in threads correctly
This commit is contained in:
parent
bc97cdae67
commit
723d44b92b
@ -402,13 +402,9 @@ def append_fragment(frag_content, frag_index, ctx):
|
|||||||
if can_threaded_download and max_workers > 1:
|
if can_threaded_download and max_workers > 1:
|
||||||
|
|
||||||
def _download_fragment(fragment):
|
def _download_fragment(fragment):
|
||||||
try:
|
ctx_copy = ctx.copy()
|
||||||
ctx_copy = ctx.copy()
|
frag_content, frag_index = download_fragment(fragment, ctx_copy)
|
||||||
frag_content, frag_index = download_fragment(fragment, ctx_copy)
|
return fragment, frag_content, frag_index, ctx_copy.get('fragment_filename_sanitized')
|
||||||
return fragment, frag_content, frag_index, ctx_copy.get('fragment_filename_sanitized')
|
|
||||||
except Exception:
|
|
||||||
# Return immediately on exception so that it is raised in the main thread
|
|
||||||
return
|
|
||||||
|
|
||||||
self.report_warning('The download speed shown is only of one thread. This is a known issue and patches are welcome')
|
self.report_warning('The download speed shown is only of one thread. This is a known issue and patches are welcome')
|
||||||
with concurrent.futures.ThreadPoolExecutor(max_workers) as pool:
|
with concurrent.futures.ThreadPoolExecutor(max_workers) as pool:
|
||||||
|
Loading…
Reference in New Issue
Block a user