mirror of
https://github.com/frappe/gunicorn.git
synced 2026-01-14 11:09:11 +08:00
Fix async worker integration.
This commit is contained in:
parent
f02cbc10ed
commit
bcaf21b62c
@ -21,7 +21,7 @@ class AsyncWorker(Worker):
|
|||||||
Worker.__init__(self, *args, **kwargs)
|
Worker.__init__(self, *args, **kwargs)
|
||||||
self.worker_connections = self.cfg.worker_connections
|
self.worker_connections = self.cfg.worker_connections
|
||||||
|
|
||||||
def timeout(self):
|
def timeout_ctx(self):
|
||||||
raise NotImplementedError()
|
raise NotImplementedError()
|
||||||
|
|
||||||
def handle(self, client, addr):
|
def handle(self, client, addr):
|
||||||
@ -30,7 +30,7 @@ class AsyncWorker(Worker):
|
|||||||
try:
|
try:
|
||||||
while True:
|
while True:
|
||||||
req = None
|
req = None
|
||||||
with self.timeout():
|
with self.timeout_ctx():
|
||||||
req = parser.next()
|
req = parser.next()
|
||||||
if not req:
|
if not req:
|
||||||
break
|
break
|
||||||
@ -45,8 +45,6 @@ class AsyncWorker(Worker):
|
|||||||
self.log.warn("Ignoring connection reset")
|
self.log.warn("Ignoring connection reset")
|
||||||
else:
|
else:
|
||||||
self.log.warn("Ignoring EPIPE")
|
self.log.warn("Ignoring EPIPE")
|
||||||
except UnexpectedEOF:
|
|
||||||
self.log.exception("Client closed the connection unexpectedly.")
|
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
self.log.exception("General error processing request.")
|
self.log.exception("General error processing request.")
|
||||||
try:
|
try:
|
||||||
|
|||||||
@ -32,7 +32,7 @@ class EventletWorker(AsyncWorker):
|
|||||||
hubs.use_hub()
|
hubs.use_hub()
|
||||||
super(EventletWorker, self).init_process()
|
super(EventletWorker, self).init_process()
|
||||||
|
|
||||||
def timeout(self):
|
def timeout_ctx(self):
|
||||||
return eventlet.Timeout(self.cfg.keepalive, False)
|
return eventlet.Timeout(self.cfg.keepalive, False)
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
|
|||||||
@ -22,7 +22,7 @@ class GEventWorker(AsyncWorker):
|
|||||||
from gevent import monkey
|
from gevent import monkey
|
||||||
monkey.patch_all(dns=False)
|
monkey.patch_all(dns=False)
|
||||||
|
|
||||||
def timeout(self):
|
def timeout_ctx(self):
|
||||||
return gevent.Timeout(self.cfg.keepalive, False)
|
return gevent.Timeout(self.cfg.keepalive, False)
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user