Module Limiter_async
Implements an async aware throttling rate limiter on top of Limiter.
All forms of enqueue_exn and enqueue' below will raise if the requested job is not possible to run within the resource limitations given to the related create_exn.
If any enqueued job raises then the exception will be raised to the monitor in scope when enqueue_exn is called. Deferred jobs passed to enqueue' return Raised (in a deferred manner) instead.
Jobs are always executed in FIFO order.
module Outcome : sig ... endThe outcome of a job
val sexp_of_t : t -> Ppx_sexp_conv_lib.Sexp.t
type limiter= t
val sexp_of_limiter : limiter -> Ppx_sexp_conv_lib.Sexp.t
Specialized limiters
A collection of limiters, specialized to different use-cases, all supporting a shared subset of their interface
module type Common = sig ... endmodule Token_bucket : sig ... endmodule Throttle : sig ... endImplements a basic throttle meant to bound the number of jobs that can concurrently run. Additionally the
~burst_sizeand~sustained_rate_per_secarguments can be used to control how many jobs can be spawned in a burst, and how quickly jobs can be spawned over time. If these options are not given tocreate_exnthey are unbounded.
module Sequencer : sig ... endA sequencer is a throttle that is specialized to only allow one job at a time and to, by default, not continue on error.
module Resource_throttle : sig ... endA resource throttle holds a static list of
nresources that are handed out in a round-robin fashion to up tonconcurrent jobs. A resource given tocreatemay be re-used many times in the lifetime oftbut will never be used by more than one job at a time.
module Expert : sig ... end