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)
|
||||
self.worker_connections = self.cfg.worker_connections
|
||||
|
||||
def timeout(self):
|
||||
def timeout_ctx(self):
|
||||
raise NotImplementedError()
|
||||
|
||||
def handle(self, client, addr):
|
||||
@ -30,7 +30,7 @@ class AsyncWorker(Worker):
|
||||
try:
|
||||
while True:
|
||||
req = None
|
||||
with self.timeout():
|
||||
with self.timeout_ctx():
|
||||
req = parser.next()
|
||||
if not req:
|
||||
break
|
||||
@ -45,8 +45,6 @@ class AsyncWorker(Worker):
|
||||
self.log.warn("Ignoring connection reset")
|
||||
else:
|
||||
self.log.warn("Ignoring EPIPE")
|
||||
except UnexpectedEOF:
|
||||
self.log.exception("Client closed the connection unexpectedly.")
|
||||
except Exception, e:
|
||||
self.log.exception("General error processing request.")
|
||||
try:
|
||||
|
||||
@ -31,8 +31,8 @@ class EventletWorker(AsyncWorker):
|
||||
def init_process(self):
|
||||
hubs.use_hub()
|
||||
super(EventletWorker, self).init_process()
|
||||
|
||||
def timeout(self):
|
||||
|
||||
def timeout_ctx(self):
|
||||
return eventlet.Timeout(self.cfg.keepalive, False)
|
||||
|
||||
def run(self):
|
||||
|
||||
@ -22,7 +22,7 @@ class GEventWorker(AsyncWorker):
|
||||
from gevent import monkey
|
||||
monkey.patch_all(dns=False)
|
||||
|
||||
def timeout(self):
|
||||
def timeout_ctx(self):
|
||||
return gevent.Timeout(self.cfg.keepalive, False)
|
||||
|
||||
def run(self):
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user