I'm getting connection refused because too many open connections: 204
when trying to do MyApp.objects.get(foo=bar)
in a gevent process. In models.py I have connect('my_db')
. In my script I do gevent.monkey.patch_all()
I've seen this question
pymongo + gevent: throw me a banana and just monkey_patch?
and this issue
https://github.com/hmarr/mongoengine/issues/272
but I don't understand how to get access to the connection to call end_request
. I've also tried this patch but it doesn't help me (unless I'm using it wrong)