View Source ProcessHub.Utility.TimerMap (ProcessHub v0.6.0)

Per-key timer bookkeeping over a plain map of key => timer_ref.

Used for fail-safe timers that must be tracked and cancelled per key (e.g. per-node reconciliation), re-arming cleanly when a key flaps by cancelling any pending timer before scheduling a new one. All timers are delivered to the calling process via Process.send_after/3.

Summary

Functions

Cancels and drops the timer tracked under key, if any. Returns the updated map.

Cancels the timers tracked under each of keys. Returns the updated map.

Schedules msg to the caller after delay ms under key, cancelling any timer already tracked for it.

Types

@type t() :: %{optional(term()) => reference()}

Functions

@spec cancel(t(), term()) :: t()

Cancels and drops the timer tracked under key, if any. Returns the updated map.

Link to this function

cancel_all(timers, keys)

View Source
@spec cancel_all(t(), [term()]) :: t()

Cancels the timers tracked under each of keys. Returns the updated map.

Link to this function

put(timers, key, msg, delay)

View Source
@spec put(t(), term(), term(), non_neg_integer()) :: t()

Schedules msg to the caller after delay ms under key, cancelling any timer already tracked for it.