|
@ -600,11 +600,14 @@ async def solve_dependencies( |
|
|
else: |
|
|
else: |
|
|
stack = request.scope.get("fastapi_astack") |
|
|
stack = request.scope.get("fastapi_astack") |
|
|
assert isinstance(stack, AsyncExitStack) |
|
|
assert isinstance(stack, AsyncExitStack) |
|
|
called = run_in_threadpool(call, **sub_values) |
|
|
called = await run_in_threadpool(call, **sub_values) |
|
|
if hasattr(called, "__aenter__"): |
|
|
if hasattr(called, "__aenter__"): |
|
|
solved = await stack.enter_async_context(called) |
|
|
solved = await stack.enter_async_context(called) |
|
|
|
|
|
elif hasattr(called, "__enter__"): |
|
|
|
|
|
cm = contextmanager_in_threadpool(called) |
|
|
|
|
|
solved = await stack.enter_async_context(cm) |
|
|
else: |
|
|
else: |
|
|
solved = await called |
|
|
solved = called |
|
|
if sub_dependant.name is not None: |
|
|
if sub_dependant.name is not None: |
|
|
values[sub_dependant.name] = solved |
|
|
values[sub_dependant.name] = solved |
|
|
if sub_dependant.cache_key not in dependency_cache: |
|
|
if sub_dependant.cache_key not in dependency_cache: |
|
|