Fix async worker integration.

This commit is contained in:
Paul J. Davis 2010-04-27 18:54:21 -04:00
parent f02cbc10ed
commit bcaf21b62c
3 changed files with 5 additions and 7 deletions

View File

@ -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:

View File

@ -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):

View File

@ -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):