updating worker to have exception_handlers

main
Bradley Young 10 years ago
parent 5caccaabfe
commit f575137612

@ -111,7 +111,7 @@ class Worker(object):
def __init__(self, queues, name=None, def __init__(self, queues, name=None,
default_result_ttl=None, connection=None, default_result_ttl=None, connection=None,
exc_handler=None, default_worker_ttl=None, job_class=None): # noqa exception_handlers="default", default_worker_ttl=None, job_class=None): # noqa
if connection is None: if connection is None:
connection = get_current_connection() connection = get_current_connection()
self.connection = connection self.connection = connection
@ -139,12 +139,13 @@ class Worker(object):
# By default, push the "move-to-failed-queue" exception handler onto # By default, push the "move-to-failed-queue" exception handler onto
# the stack # the stack
self.push_exc_handler(self.move_to_failed_queue) if exception_handlers == "default":
if isinstance(exc_handler, list): self.push_exc_handler(self.move_to_failed_queue)
for h in exc_handler: elif isinstance(exception_handlers, list):
for h in exception_handlers:
self.push_exc_handler(h) self.push_exc_handler(h)
elif exc_handler is not None: elif exception_handlers is not None:
self.push_exc_handler(exc_handler) self.push_exc_handler(exception_handlers)
if job_class is not None: if job_class is not None:
if isinstance(job_class, string_types): if isinstance(job_class, string_types):

Loading…
Cancel
Save