remotivelabs.topology.time.async_ticker

def create_ticker( interval_in_sec: float, on_tick: remotivelabs.topology.time.callback.OnTickCallback, loop: asyncio.events.AbstractEventLoop | None = None) -> _asyncio.Task:

Creates a ticker that calls the on_tick function at the given interval.

Note that the timer is a best effort timer. The actual interval may be longer than the specified interval if concurrent tasks are unwilling to yield the CPU.

Arguments:
  • interval_in_sec: The time interval in seconds between each tick
  • on_tick: Callback function that will be called on each tick.
  • loop: The event loop to schedule callbacks on. If None, uses the current loop
Returns:

A task that can be awaited or cancelled to stop the ticker