def download_chunks(self, max_workers=5):
print('Will now download chunks.')
original_sigint_handler = signal.signal(signal.SIGINT, signal.SIG_IGN)
executor = Pool(max_workers)
signal.signal(signal.SIGINT, original_sigint_handler)
try:
r = executor.map_async(self.get, self.urls)
result = list(r.get(43200))
DownloadResultProcessor.process_and_print(result)
except KeyboardInterrupt:
executor.terminate()
else:
executor.close()
executor.join()
评论列表
文章目录