소스 검색

timer2.Timer.run: We might lose the race at interpreter shutdown, so gc has already collected the built-in modules.

Ask Solem 14 년 전
부모
커밋
6707aefd3b
1개의 변경된 파일6개의 추가작업 그리고 1개의 파일을 삭제
  1. 6 1
      celery/utils/timer2.py

+ 6 - 1
celery/utils/timer2.py

@@ -151,7 +151,12 @@ class Timer(Thread):
             if sleep is None:
                 break
             sleep(delay)
-        self._stopped.set()
+        try:
+            self._stopped.set()
+        except TypeError:
+            # we lost the race at interpreter shutdown,
+            # so gc collected built-in modules.
+            pass
 
     def stop(self):
         if self.running: