浏览代码

Make sure when __call__ing a task, that a proper fresh request is pushed on the stack.

Steeve Morin 13 年之前
父节点
当前提交
3e09af587f
共有 1 个文件被更改,包括 2 次插入0 次删除
  1. 2 0
      celery/app/task.py

+ 2 - 0
celery/app/task.py

@@ -344,9 +344,11 @@ class Task(object):
 
     def __call__(self, *args, **kwargs):
         _task_stack.push(self)
+        self.push_request()
         try:
             return self.run(*args, **kwargs)
         finally:
+            self.pop_request()
             _task_stack.pop()
 
     # - tasks are pickled into the name of the task only, and the reciever