circuits.core.timers module

Timer component to facilitate timed events.

class circuits.core.timers.Timer(*args, **kwargs)

Bases: BaseComponent

Timer Component

A timer is a component that fires an event once after a certain delay or periodically at a regular interval.

Parameters
  • interval (datetime or number of seconds as a float) – the delay or interval to wait for until the event is fired. If interval is specified as datetime, the interval is recalculated as the time span from now to the given datetime.

  • event (Event) – the event to fire.

  • persist (bool) – An optional keyword argument which if True will cause the event to be fired repeatedly once per configured interval until the timer is unregistered. If False, the event fires exactly once after the specified interval, and the timer is unregistered. Default: False

reset(interval=None)

Reset the timer, i.e. clear the amount of time already waited for.

property expiry