瀏覽代碼

Timing issue when declaring the remote control command reply queue meant replies could be lost

Ask Solem 14 年之前
父節點
當前提交
5f35aa0c4c
共有 1 個文件被更改,包括 5 次插入2 次删除
  1. 5 2
      celery/task/control.py

+ 5 - 2
celery/task/control.py

@@ -181,6 +181,10 @@ def broadcast(command, arguments=None, destination=None, connection=None,
     if limit is None and destination:
         limit = destination and len(destination) or None
 
+    crq = None
+    if reply_ticket:
+        crq = ControlReplyConsumer(connection, reply_ticket)
+
     broadcast = BroadcastPublisher(connection)
     try:
         broadcast.send(command, arguments, destination=destination,
@@ -188,8 +192,7 @@ def broadcast(command, arguments=None, destination=None, connection=None,
     finally:
         broadcast.close()
 
-    if reply_ticket:
-        crq = ControlReplyConsumer(connection, reply_ticket)
+    if crq:
         try:
             return crq.collect(limit=limit, timeout=timeout,
                                callback=callback)