La referencia de la API está disponible solo en inglés por ahora.

EffectRunner

class
yoltra/effects.py:104

Dispatches per-event effects and bridges sync `emit` to async effects.

Constructor

constructor

Initialize self. See help(type(self)) for accurate signature.

signature
new(mode?): None

Initialize self. See help(type(self)) for accurate signature.

Parameters

NameTypeDescription
mode?"auto" | "inline" | "asyncio"

Returns

None

Properties

NameTypeDescription
queue_depthintNumber of events whose effects are currently in flight.

Methods

dispatch

Schedule an event's effects and return its `EmitHandle`.

signature
dispatch(run, event_id, committed): EmitHandle

Schedule an event's effects and return its `EmitHandle`.

Parameters

NameTypeDescription
run() => anyA thunk running the event's effects. Sync in `inline` mode; a coroutine function (returning an awaitable) otherwise.
NameTypeDescription
event_idstrThe event's id.
NameTypeDescription
committedboolWhether the event committed. Uncommitted events run no effects and get an already-settled handle.

Returns

EmitHandleAn `EmitHandle` that settles when the effects finish.

dispose

Tear down the daemon effect loop, if one was started.

signature
dispose(timeout?): None

Tear down the daemon effect loop, if one was started.

Parameters

NameTypeDescription
timeout?floatSeconds to wait for the worker thread to stop.

Returns

None