Explorar o código

Batches: Do not attempt to cancel non-existing tref. Closes #1984

Ask Solem %!s(int64=11) %!d(string=hai) anos
pai
achega
72899335c4
Modificáronse 1 ficheiros con 2 adicións e 1 borrados
  1. 2 1
      celery/contrib/batches.py

+ 2 - 1
celery/contrib/batches.py

@@ -226,7 +226,8 @@ class Batches(Task):
                 self.flush(requests)
         if not requests:
             logger.debug('Batches: Cancelling timer: Nothing in buffer.')
-            self._tref.cancel()  # cancel timer.
+            if self._tref:
+                self._tref.cancel()  # cancel timer.
             self._tref = None
 
     def apply_buffer(self, requests, args=(), kwargs={}):