package core_kernel

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type

A Throttled_rate_limiter combines a Token_bucket and a Throttle. Unlike a Token_bucket, jobs cannot consume variable numbers of tokens, but the number of outstanding jobs is also limited to max_concurrent_jobs. Like a Throttle, finish_job must be called once, and only once, when a job is completed.

A Throttled_rate_limiter combines a Token_bucket and a Throttle. Unlike a Token_bucket, jobs cannot consume variable numbers of tokens, but the number of outstanding jobs is also limited to max_concurrent_jobs. Like a Throttle, finish_job must be called once, and only once, when a job is completed.

type t = private Limiter.limiter
val create_exn : now:Time_ns.t -> burst_size:Base.Int.t -> sustained_rate_per_sec:Base.Float.t -> max_concurrent_jobs:Base.Int.t -> t
val try_start_job : t -> now:Time_ns.t -> [ `Start | `Max_concurrent_jobs_running | `Unable_until_at_least of Time_ns.t ]
val finish_job : t -> now:Time_ns.t -> Base.Unit.t
OCaml

Innovation. Community. Security.