Browse Source

🐛 Check async generator before regular generator to execute that first, as that's the special case

pull/14448/head
Sebastián Ramírez 8 months ago
parent
commit
230c550220
  1. 6
      fastapi/dependencies/utils.py

6
fastapi/dependencies/utils.py

@ -548,10 +548,10 @@ async def _solve_generator(
*, dependant: Dependant, stack: AsyncExitStack, sub_values: Dict[str, Any]
) -> Any:
assert dependant.call
if dependant.is_gen_callable:
cm = contextmanager_in_threadpool(contextmanager(dependant.call)(**sub_values))
elif dependant.is_async_gen_callable:
if dependant.is_async_gen_callable:
cm = asynccontextmanager(dependant.call)(**sub_values)
elif dependant.is_gen_callable:
cm = contextmanager_in_threadpool(contextmanager(dependant.call)(**sub_values))
return await stack.enter_async_context(cm)

Loading…
Cancel
Save