python 中的run_in_executor 设置默认线程池,亲测成功

Posted 68 months ago python loop eventloop run_in_executor 线程池

run_on_executor 本身就设置了线程最大数

run_in_executor 设置默认线程池


exe = ThreadPoolExecutor(2)
asyncio.get_event_loop().set_default_executor(exe)

即可~

在idea的debug测试

完美!

点击评论