Functions
invoke
5
Any
▼
Call a handler and await the result if it's a coroutine.
When *is_async* is pr…
async
invoke
5
Any
▼
async def invoke(handler: Any, *args: Any, is_async: bool | None = None, inline_sync: bool = False, **kwargs: Any) -> Any
Call a handler and await the result if it's a coroutine.
When is_async is provided (from a compiled InvokePlan), the per-request
inspect.iscoroutinefunctioncall is skipped entirely.
When inline_sync is True and the handler is synchronous, it runs on the
event loop thread instead ofasyncio.to_thread— useful for lightweight
handlers where the thread-dispatch overhead exceeds the work itself.
Parameters
| Name | Type | Description |
|---|---|---|
handler |
Any |
|
*args |
Any |
|
is_async |
bool | None |
Default:None
|
inline_sync |
bool |
Default:False
|
**kwargs |
Any |
Returns
Any