network.py 文件源码

python
阅读 22 收藏 0 点赞 0 评论 0

项目:twentybn-dl 作者: TwentyBN 项目源码 文件源码
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()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号