duck.http.core.httpd.task_executor¶
Module containing RequestHandlingExecutor which handles execution of async coroutines and threaded tasks efficiently.
Module Contents¶
Classes¶
A hybrid task executor for handling both async coroutines and blocking CPU-bound operations using threads efficiently. |
API¶
- class duck.http.core.httpd.task_executor.RequestHandlingExecutor[source]¶
A hybrid task executor for handling both async coroutines and blocking CPU-bound operations using threads efficiently.
Initialization
Initialize the RequestHandlingExecutor.
- execute(task: Union[Callable, Coroutine])[source]¶
Public interface to execute a task. It routes the task to either the async task queue or the thread pool, depending on its type.
- Parameters:
task –
The task to run.
If async, it’s queued to run in event loop.
If sync, it’s submitted to the thread pool.