Procházet zdrojové kódy

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

Ask Solem před 14 roky
rodič
revize
6707aefd3b
1 změnil soubory, kde provedl 6 přidání a 1 odebrání
  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: