mirror of
https://github.com/derrod/legendary.git
synced 2024-12-22 01:45:28 +00:00
[downloader/mp] Also kill workers on interrupt if they don't exit themselves
This commit is contained in:
parent
2474c43b7b
commit
fc66f9f372
|
@ -585,6 +585,12 @@ class DLManager(Process):
|
||||||
if t.is_alive():
|
if t.is_alive():
|
||||||
self.log.warning(f'Thread did not terminate! {repr(t)}')
|
self.log.warning(f'Thread did not terminate! {repr(t)}')
|
||||||
|
|
||||||
|
# forcibly kill DL workers that are not actually dead yet
|
||||||
|
for child in self.children:
|
||||||
|
child.join(timeout=5.0)
|
||||||
|
if child.exitcode is None:
|
||||||
|
child.terminate()
|
||||||
|
|
||||||
# clean up all the queues, otherwise this process won't terminate properly
|
# clean up all the queues, otherwise this process won't terminate properly
|
||||||
for name, q in zip(('Download jobs', 'Writer jobs', 'Download results', 'Writer results'),
|
for name, q in zip(('Download jobs', 'Writer jobs', 'Download results', 'Writer results'),
|
||||||
(self.dl_worker_queue, self.writer_queue, self.dl_result_q, self.writer_result_q)):
|
(self.dl_worker_queue, self.writer_queue, self.dl_result_q, self.writer_result_q)):
|
||||||
|
|
Loading…
Reference in a new issue