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

Commit 83f1ccf

Browse files
committed
Fix dropping locks on shut down
1 parent 97c8ae9 commit 83f1ccf

File tree

1 file changed

+5
-1
lines changed
  • synapse/storage/databases/main

1 file changed

+5
-1
lines changed

synapse/storage/databases/main/lock.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,11 @@ async def _on_shutdown(self) -> None:
7878
"""Called when the server is shutting down"""
7979
logger.info("Dropping held locks due to shutdown")
8080

81-
for (lock_name, lock_key), token in self._live_tokens.items():
81+
# We need to take a copy of the tokens dict as dropping the locks will
82+
# cause the dictionary to change.
83+
tokens = dict(self._live_tokens)
84+
85+
for (lock_name, lock_key), token in tokens.items():
8286
await self._drop_lock(lock_name, lock_key, token)
8387

8488
logger.info("Dropped locks due to shutdown")

0 commit comments

Comments
 (0)