Преглед изворни кода

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: