Skip to content

Commit d808f70

Browse files
committed
Added missing AsyncExitStack
1 parent bcfb8d2 commit d808f70

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

debug_toolbar/panels/sqlalchemy.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
from time import perf_counter
33

44
from fastapi import Request, Response
5+
from fastapi.concurrency import AsyncExitStack
56
from fastapi.dependencies.utils import solve_dependencies
67
from fastapi.routing import APIRoute
78
from sqlalchemy import event
@@ -58,6 +59,10 @@ async def process_request(self, request: Request) -> Response:
5859

5960
if hasattr(route, "dependant"):
6061
route = t.cast(APIRoute, route)
62+
63+
if request.scope.get("fastapi_astack") is None:
64+
async with AsyncExitStack() as stack:
65+
request.scope["fastapi_astack"] = stack
6166
try:
6267
solved_result = await solve_dependencies(
6368
request=request,

0 commit comments

Comments
 (0)