Explorar el Código

celery crashes on git pull

If tasks.py file is modified in git repository and I run git pull on server, then celery crashes.

"Git pull" first removes the file and then restores it, but pyinotify catches removal event.

I updated _maybe_modified function to first verify if file exists and if not then mark file as "unmodified", because afterwards will be another event when file is recreated.
Agris Ameriks hace 12 años
padre
commit
e7fc06221a
Se han modificado 1 ficheros con 5 adiciones y 4 borrados
  1. 5 4
      celery/worker/autoreload.py

+ 5 - 4
celery/worker/autoreload.py

@@ -251,10 +251,11 @@ class Autoreloader(bgThread):
             self._monitor.start()
 
     def _maybe_modified(self, f):
-        digest = file_hash(f)
-        if digest != self._hashes[f]:
-            self._hashes[f] = digest
-            return True
+        if os.path.exists(f):
+            digest = file_hash(f)
+            if digest != self._hashes[f]:
+                self._hashes[f] = digest
+                return True
         return False
 
     def on_change(self, files):