log error

This commit is contained in:
j 2020-05-30 21:23:04 +02:00
parent 5f9a2b9879
commit 830386214c

View file

@ -1,5 +1,5 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from __future__ import absolute_import import logging
from django.conf import settings from django.conf import settings
@ -8,6 +8,7 @@ from kombu.mixins import ConsumerMixin
from . import daemon, key from . import daemon, key
logger = logging.getLogger('pandora.websocket')
queue = Queue('websocket', Exchange(key, type='direct'), routing_key=key) queue = Queue('websocket', Exchange(key, type='direct'), routing_key=key)
@ -22,8 +23,11 @@ class Worker(ConsumerMixin):
callbacks=[self.process_task])] callbacks=[self.process_task])]
def process_task(self, body, message): def process_task(self, body, message):
try:
if body['task'] == 'trigger_event': if body['task'] == 'trigger_event':
daemon.trigger_event(*body['args']) daemon.trigger_event(*body['args'])
except:
logger.error('faild to trigger event %s', body, exc_info=True)
message.ack() message.ack()
def run(): def run():