gleam/otp/intensity_tracker

The intensity tracker is used to monitor how frequently an event happens, erroring if it happens too many times within a period of time.

Types

pub opaque type IntensityTracker
pub type TooIntense {
  TooIntense
}

Constructors

  • TooIntense

Functions

pub fn add_event(tracker: IntensityTracker) -> Result(
  IntensityTracker,
  TooIntense,
)
pub fn new(limit limit: Int, period period: Int) -> IntensityTracker
pub fn trim_window(events: List(Int), now: Int, period: Int) -> List(
  Int,
)
Search Document