带有线程TTL的后端口ThreadPoolExecutor
timeoutthreadpoolexecutor的Python项目详细描述
这个库试图通过使用后端口来解决我在Python3.7中使用1000多个空闲线程的问题 ThreadPoolExecutor(具有线程重用)并给线程一个TTL。在
对于短生命周期的线程,可能没有理由使用它。在
使用
有两种方法可以使用此库,覆盖默认的hadPoolExecutor或直接使用它。在
要覆盖默认值,请在项目执行任何其他操作之前首先执行此操作。在
fromtimeoutthreadpoolexecutorimportTimeoutThreadPoolExecutorfromconcurrent.futuresimportthreadthread.ThreadPoolExecutor=TimeoutThreadPoolExecutor
或者
^{pr2}$许可证
我猜和Python一样。在
- 项目
标签: