Fix dropping locks on shut down (#10433)

This commit is contained in:
Erik Johnston 2021-07-20 14:24:25 +01:00 committed by GitHub
parent 96e63ec7bf
commit 54389d5697
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 19 additions and 1 deletions

View file

@ -78,7 +78,11 @@ class LockStore(SQLBaseStore):
"""Called when the server is shutting down"""
logger.info("Dropping held locks due to shutdown")
for (lock_name, lock_key), token in self._live_tokens.items():
# We need to take a copy of the tokens dict as dropping the locks will
# cause the dictionary to change.
tokens = dict(self._live_tokens)
for (lock_name, lock_key), token in tokens.items():
await self._drop_lock(lock_name, lock_key, token)
logger.info("Dropped locks due to shutdown")