From 830386214ccf1deca98fdaf0842512bc1af203a5 Mon Sep 17 00:00:00 2001 From: j Date: Sat, 30 May 2020 21:23:04 +0200 Subject: [PATCH] log error --- pandora/websocket/worker.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/pandora/websocket/worker.py b/pandora/websocket/worker.py index 72c35e5af..1a0e633d4 100644 --- a/pandora/websocket/worker.py +++ b/pandora/websocket/worker.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -from __future__ import absolute_import +import logging from django.conf import settings @@ -8,6 +8,7 @@ from kombu.mixins import ConsumerMixin from . import daemon, key +logger = logging.getLogger('pandora.websocket') queue = Queue('websocket', Exchange(key, type='direct'), routing_key=key) @@ -22,8 +23,11 @@ class Worker(ConsumerMixin): callbacks=[self.process_task])] def process_task(self, body, message): - if body['task'] == 'trigger_event': - daemon.trigger_event(*body['args']) + try: + if body['task'] == 'trigger_event': + daemon.trigger_event(*body['args']) + except: + logger.error('faild to trigger event %s', body, exc_info=True) message.ack() def run():