Skip to content
This repository was archived by the owner on Aug 19, 2025. It is now read-only.

Commit e3e7fa0

Browse files
Avoid dangling task-local connections after Database.disconnect() (#211)
Co-authored-by: Amin Alaee <[email protected]>
1 parent 975e616 commit e3e7fa0

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

databases/core.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,8 @@ async def disconnect(self) -> None:
118118

119119
self._global_transaction = None
120120
self._global_connection = None
121+
else:
122+
self._connection_context = contextvars.ContextVar("connection_context")
121123

122124
await self._backend.disconnect()
123125
logger.info(

0 commit comments

Comments
 (0)