run_endpoint_function
Executes a dependency or endpoint function by either awaiting it directly if it is a coroutine or running it in a threadpool if it is a synchronous function.
def run_endpoint_function(
dependant: Dependant,
values: dict[str, Any],
is_coroutine: bool
) - > Any
Executes the underlying endpoint function or dependency callable using the provided resolved values. This function handles the distinction between asynchronous and synchronous callables by either awaiting the coroutine directly or offloading the blocking call to a threadpool.
Parameters
| Name | Type | Description |
|---|---|---|
| dependant | Dependant | An object containing the reference to the callable function to be executed. |
| values | dict[str, Any] | A dictionary of keyword arguments containing resolved dependencies and path/query parameters to pass to the function. |
| is_coroutine | bool | A flag indicating whether the callable is an 'async def' function that requires awaiting. |
Returns
| Type | Description |
|---|---|
Any | The result returned by the endpoint function or dependency callable after execution. |