Skip to content

Commit 937f600

Browse files
authored
Tortoise.close_connection now propagates to context (#2112)
1 parent 16714c0 commit 937f600

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

CHANGELOG.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ Fixed
2525
- MySQL schema editor: FK index protection (``_create_missing_fk_index``) prevents MySQL error 1553 when dropping the only index covering a foreign key column.
2626
- MySQL schema editor: expression default two-step workaround for ``ADD COLUMN`` with non-deterministic ``SqlDefault`` expressions (e.g. ``RANDOM_BYTES``).
2727
- Multi-column constraint introspection — constraint name resolution now matches on the exact set of columns across all backends (PostgreSQL, MySQL, MSSQL, SQLite, Oracle).
28+
- Tortoise.close_connections() now propagates call to current context. (#2110)
2829

2930
1.1.3
3031
-----

tortoise/__init__.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -491,7 +491,9 @@ async def close_connections(cls) -> None:
491491
else your event loop may never complete
492492
as it is waiting for the connections to die.
493493
"""
494-
await get_connections().close_all()
494+
ctx = cls._get_context()
495+
if ctx is not None:
496+
await ctx.close_connections()
495497
logger.info("Tortoise-ORM shutdown")
496498

497499
@classmethod

0 commit comments

Comments
 (0)