Skip to content

CallbackExecutor

veltix.handler.callback_executor.CallbackExecutor

Executes user callbacks in a thread pool to avoid blocking the recv loop.

Worker threads are daemon threads, so they never block interpreter shutdown. As a consequence, callbacks that are still queued or in progress when the process exits are dropped unless :meth:shutdown with wait=True is called beforehand.

submit

submit(func: Callable[..., Any], *args: Any) -> None

Submit a callback for async execution.

Returns immediately without waiting for the callback to run. Exceptions raised inside the callback are caught and reported via the bus.

Parameters:

Name Type Description Default
func Callable[..., Any]

Callable to execute.

required
*args Any

Positional arguments passed to the callable.

()

shutdown

shutdown(wait: bool = True) -> None

Shutdown the executor.

Parameters:

Name Type Description Default
wait bool

If True, blocks until all pending callbacks have run and every worker thread has exited.

True