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
IntensityTracker
pub opaque type IntensityTracker
TooIntense
pub type TooIntense { TooIntense }
Constructors
-
TooIntense
Functions
add_event
pub fn add_event( tracker: IntensityTracker, ) -> Result(IntensityTracker, TooIntense)
new
pub fn new( limit limit: Int, period period: Int, ) -> IntensityTracker
trim_window
pub fn trim_window( events: List(Int), now: Int, period: Int, ) -> List(Int)