mirror of
https://github.com/frappe/gunicorn.git
synced 2026-01-14 11:09:11 +08:00
work around evdns not playing well with fork
This commit is contained in:
parent
9f941215d1
commit
dbd66b6191
@ -35,7 +35,7 @@ class GeventWorker(AsyncWorker):
|
|||||||
@classmethod
|
@classmethod
|
||||||
def setup(cls):
|
def setup(cls):
|
||||||
from gevent import monkey
|
from gevent import monkey
|
||||||
monkey.patch_all(dns=False)
|
monkey.patch_all()
|
||||||
|
|
||||||
def timeout_ctx(self):
|
def timeout_ctx(self):
|
||||||
return gevent.Timeout(self.cfg.keepalive, False)
|
return gevent.Timeout(self.cfg.keepalive, False)
|
||||||
@ -59,6 +59,13 @@ class GeventWorker(AsyncWorker):
|
|||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
def init_process(self):
|
||||||
|
#gevent doesn't reinitialize dns for us after forking
|
||||||
|
#here's the workaround
|
||||||
|
gevent.core.dns_shutdown(fail_requests=1)
|
||||||
|
gevent.core.dns_init()
|
||||||
|
super(GeventWorker, self).init_process()
|
||||||
|
|
||||||
def acceptor(self, pool):
|
def acceptor(self, pool):
|
||||||
gevent.getcurrent()
|
gevent.getcurrent()
|
||||||
while self.alive:
|
while self.alive:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user