Explorar o código

Merge pull request #2985 from aleks-v-k/3.1

Added cleaning of corrupted scheduler files for some storage backend errors
Ask Solem Hoel %!s(int64=9) %!d(string=hai) anos
pai
achega
16b7df7963
Modificáronse 1 ficheiros con 6 adicións e 0 borrados
  1. 6 0
      celery/beat.py

+ 6 - 0
celery/beat.py

@@ -374,6 +374,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)