Procházet zdrojové kódy

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

Steeve Morin před 13 roky
rodič
revize
3e09af587f
1 změnil soubory, kde provedl 2 přidání a 0 odebrání
  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):
     def __call__(self, *args, **kwargs):
         _task_stack.push(self)
         _task_stack.push(self)
+        self.push_request()
         try:
         try:
             return self.run(*args, **kwargs)
             return self.run(*args, **kwargs)
         finally:
         finally:
+            self.pop_request()
             _task_stack.pop()
             _task_stack.pop()
 
 
     # - tasks are pickled into the name of the task only, and the reciever
     # - tasks are pickled into the name of the task only, and the reciever