瀏覽代碼

Log errors occurring while handling control commands, instead of propagating.

Ask Solem 14 年之前
父節點
當前提交
b863cfa88f
共有 1 個文件被更改,包括 7 次插入1 次删除
  1. 7 1
      celery/worker/listener.py

+ 7 - 1
celery/worker/listener.py

@@ -77,6 +77,7 @@ from __future__ import generators
 
 import socket
 import sys
+import traceback
 import warnings
 
 from carrot.connection import AMQPConnectionException
@@ -293,7 +294,12 @@ class CarrotListener(object):
 
     def on_control(self, control):
         """Handle received remote control command."""
-        return self.control_dispatch.dispatch_from_message(control)
+        try:
+            self.control_dispatch.dispatch_from_message(control)
+        except Exception, exc:
+            self.logger.error(
+                "Error occurred while handling control command: %r\n%s" % (
+                    exc, traceback.format_exc()))
 
     def receive_message(self, message_data, message):
         """The callback called when a new message is received. """