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

View File

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

View File

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