close the persistent shelve when we're done checking it

this code was added to detect celerybeat shelve .db corruption, but it caused a different issue; opening the shelve in this way puts a write lock on it, which means that when we attempt to open it _again_ moments later, we can't.

when we're done checking the validity of the file, we need to close it
This commit is contained in:
Ryan Petrello 2019-01-17 08:18:50 -05:00
parent 4ce18618cb
commit 37dbfa88f9
No known key found for this signature in database
GPG Key ID: F2AA5F2122351777

View File

@ -87,6 +87,11 @@ class Command(BaseCommand):
except Exception:
logger.exception('{} is corrupted, removing.'.format(sched_file))
sched._remove_db()
finally:
try:
sched.close()
except Exception:
logger.exception('{} failed to sync/close'.format(sched_file))
beat.Beat(
30,