Module Limiter.Token_bucket
Implements a basic token-bucket-based rate limiter. Users of the throttle must successfully call try_take
before doing work.
type t
= private limiter
val create_exn : now:Core_kernel.Time_ns.t -> burst_size:int -> sustained_rate_per_sec:float -> ?initial_bucket_level:int -> unit -> t
- parameter initial_bucket_level
defaults to zero
val try_take : t -> now:Core_kernel.Time_ns.t -> int -> Try_take_result.t