Fixed ModuleStorage close race by acquiring storage lock.
CI / Formatting (push) Successful in 5s
CI / Linting (push) Successful in 6s
CI / Tests (Python 3.12) (push) Successful in 2m49s
CI / Tests (Python 3.13) (push) Successful in 2m49s
CI / Tests (Python 3.14) (push) Successful in 2m49s
CI / Type Checking (push) Successful in 9s
CI / Spelling (push) Successful in 5s
CD / Publish Package (push) Successful in 9s
CD / Publish Image (push) Successful in 1m29s

This commit is contained in:
2026-04-24 20:05:33 -04:00
parent f20faa317e
commit d998429a76
2 changed files with 35 additions and 4 deletions
+5 -4
View File
@@ -286,8 +286,9 @@ class ModuleStorage:
async def _close(self) -> None:
"""Close the connection (internal use by bot)."""
self._closed = True
if self._conn is not None:
await self._conn.close()
self._conn = None
async with self._lock:
self._closed = True
if self._conn is not None:
await self._conn.close()
self._conn = None
self._logger.info("Connection closed.")