Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Commit

Permalink
Fix dropping locks on shut down
Browse files Browse the repository at this point in the history
  • Loading branch information
erikjohnston committed Jul 20, 2021
1 parent 97c8ae9 commit 83f1ccf
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion synapse/storage/databases/main/lock.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,11 @@ async def _on_shutdown(self) -> None:
"""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")
Expand Down

0 comments on commit 83f1ccf

Please sign in to comment.