Explorar el Código

Added cleaning of corrupted scheduler files for some storage backend errors

Aleksandr Kuznetsov hace 9 años
padre
commit
1abcfa713a
Se han modificado 1 ficheros con 6 adiciones y 0 borrados
  1. 6 0
      celery/beat.py

+ 6 - 0
celery/beat.py

@@ -419,6 +419,12 @@ class PersistentScheduler(Scheduler):
     def setup_schedule(self):
         try:
             self._store = self._open_schedule()
+            # In some cases there may be different errors from a storage
+            # backend for corrupted files. Example - DBPageNotFoundError
+            # exception from bsddb. In such case the file will be
+            # successfully opened but the error will be raised on first key
+            # retrieving.
+            self._store.keys()
         except Exception as exc:
             self._store = self._destroy_open_corrupted_schedule(exc)