Up

Module Token_bucket

Implements a basic token bucket based rate limiter. Users of the throttle must successfully call try_take before doing work.

Signature

type t = private limiter
val create_exn : now:Time.t -> burst_size:float -> sustained_rate_per_sec:float -> ?initial_bucket_level:float -> unit -> t
val try_take : t -> now:Time.t -> float -> Try_take_result.t