瀏覽代碼

Fixes to allow for chord callbacks in always_eager mode

Grant Thomas 13 年之前
父節點
當前提交
638db5c8e9
共有 1 個文件被更改,包括 5 次插入2 次删除
  1. 5 2
      celery/task/chords.py

+ 5 - 2
celery/task/chords.py

@@ -60,6 +60,9 @@ class chord(object):
 
     def __call__(self, body, **options):
         tid = body.options.setdefault("task_id", uuid())
-        self.Chord.apply_async((list(self.tasks), body), self.options,
+        taskset_result = self.Chord.apply_async((list(self.tasks), body), self.options,
                                 **options)
-        return body.type.app.AsyncResult(tid)
+
+        if self.Chord.app.conf.CELERY_ALWAYS_EAGER:
+            return subtask(body).apply(args=(taskset_result.result.join(),))
+        return body.type.AsyncResult(tid)