From 931f28195e01fb4d38984875a93c3ba6af62bba1 Mon Sep 17 00:00:00 2001 From: Andrew Hutchings Date: Tue, 18 Jun 2013 21:12:25 +0100 Subject: [PATCH] API: Add exception logging for gearman threads Change-Id: I0b260d22436920021b39c04b6e53196cca383a4c --- libra/api/library/gearman_client.py | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/libra/api/library/gearman_client.py b/libra/api/library/gearman_client.py index ef61fa75..7f404d8f 100644 --- a/libra/api/library/gearman_client.py +++ b/libra/api/library/gearman_client.py @@ -39,13 +39,16 @@ def submit_job(job_type, host, data, lbid): def client_job(logger, job_type, host, data, lbid): - client = GearmanClientThread(logger, host, lbid) - if job_type == 'UPDATE': - client.send_update(data) - if job_type == 'DELETE': - client.send_delete(data) - if job_type == 'ARCHIVE': - client.send_archive(data) + try: + client = GearmanClientThread(logger, host, lbid) + if job_type == 'UPDATE': + client.send_update(data) + if job_type == 'DELETE': + client.send_delete(data) + if job_type == 'ARCHIVE': + client.send_archive(data) + except: + logger.exception("Gearman thread unhandled exception") class GearmanClientThread(object):