forked from 0x2620/pandora
log error
This commit is contained in:
parent
5f9a2b9879
commit
830386214c
1 changed files with 7 additions and 3 deletions
|
@ -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):
|
||||
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():
|
||||
|
|
Loading…
Reference in a new issue