浏览代码

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: