소스 검색

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

Ask Solem 11 년 전
부모
커밋
78d6e93c24
1개의 변경된 파일2개의 추가작업 그리고 1개의 파일을 삭제
  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={}):