Don't shutdown pool or the for loop will lock

Since I'm using `futures.as_completed()`, it will never ever for loop over all tracks and segments and will forever be stuck in the primary thread of the operation. I.e., main thread for the download track threads, or the track thread for the download segment threads.

I've also removed all future cancelled checks as they will never be cancelled before they get the chance to run, because no future cancel calls are made anymore.
This commit is contained in:
rlaphoenix
2023-02-28 16:42:45 +00:00
parent 51fb7920c9
commit 9cfda3bb9c
3 changed files with 0 additions and 12 deletions

View File

@@ -520,12 +520,9 @@ class DASH:
for i, segment in enumerate(segments)
)):
finished_threads += 1
if download.cancelled():
continue
e = download.exception()
if e:
state_event.set()
pool.shutdown(wait=False, cancel_futures=True)
traceback.print_exception(e)
log.error(f"Segment Download worker threw an unhandled exception: {e!r}")
sys.exit(1)
@@ -547,7 +544,6 @@ class DASH:
download_sizes.clear()
except KeyboardInterrupt:
state_event.set()
pool.shutdown(wait=False, cancel_futures=True)
log.info("Received Keyboard Interrupt, stopping...")
return