在尝试使用 gevent 并行化 IO 绑定(bind)工作时,我收到了大量以下错误消息:
requests.exceptions.ConnectionError: HTTPConnectionPool(host='blabla.com', port=80): Max retries exceeded with url: /bla (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 16] Device or resource busy'))
我的代码看起来使用了这样的实用程序:
def run_parallel(f, it):
return pool.Group().map(f, it)
避免这些错误的正确方法是什么?
最佳答案
显然我错过了猴子补丁部分。
from gevent import monkey
monkey.patch_all()
关于python - 使用 gevent 池时出现 `NewConnectionError`,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58592515/