[Checkins] SVN: Sandbox/gotcha/five.taskqueue/trunk/src/five/taskqueue/processor.py take care of race conditions and close connection and request correctly
Jean-Francois Roche
jfroche at jfroche.be
Mon Oct 18 10:53:56 EDT 2010
Log message for revision 117721:
take care of race conditions and close connection and request correctly
Changed:
U Sandbox/gotcha/five.taskqueue/trunk/src/five/taskqueue/processor.py
-=-
Modified: Sandbox/gotcha/five.taskqueue/trunk/src/five/taskqueue/processor.py
===================================================================
--- Sandbox/gotcha/five.taskqueue/trunk/src/five/taskqueue/processor.py 2010-10-18 14:53:24 UTC (rev 117720)
+++ Sandbox/gotcha/five.taskqueue/trunk/src/five/taskqueue/processor.py 2010-10-18 14:53:56 UTC (rev 117721)
@@ -1,5 +1,6 @@
import logging
+from zExceptions import NotFound
from ZPublisher.HTTPRequest import HTTPRequest
from ZPublisher.HTTPResponse import HTTPResponse
import ZPublisher
@@ -34,15 +35,19 @@
try:
try:
ZPublisher.Publish.publish(request, 'Zope2', [None])
+ result = request.response.body
+ except NotFound, error:
+ log.warning('NotFound when traversing to %s' % '/'.join(path))
+ result = ''
except Exception, error:
# This thread should never crash, thus a blank except
log.error('Processor: ``%s()`` caused an error!' % method)
log.exception(error)
- return errorValue is ERROR_MARKER and error or errorValue
+ result = errorValue is ERROR_MARKER and error or errorValue
finally:
request.close()
conn.close()
- return request.response.body
+ return result
class SimpleProcessor(Z2PublisherMixin, BaseSimpleProcessor):
More information about the checkins
mailing list