BoopErrorTracker.Throttle (BoopErrorTracker v1.1.0)

Copy Markdown View Source

Remembers when each error last produced a push so :occurrence notifications are rate-limited per error. State lives in an ETS table owned by this process; it is not persisted.

Summary

Functions

Whether a push for key is allowed now, given a minimum gap of interval_ms. Records the send when allowed.

Returns a specification to start this module under a supervisor.

Forgets everything (tests).

Functions

allow?(key, interval_ms)

@spec allow?(term(), non_neg_integer()) :: boolean()

Whether a push for key is allowed now, given a minimum gap of interval_ms. Records the send when allowed.

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

reset()

Forgets everything (tests).

start_link(opts \\ [])

touch(key, now \\ System.monotonic_time(:millisecond))

@spec touch(term(), integer()) :: true

Records that key was just sent.