Module Limiter_async.Token_bucket
val sexp_of_t : t -> Ppx_sexp_conv_lib.Sexp.t
type _ u= t
val create_exn : burst_size:int -> sustained_rate_per_sec:float -> continue_on_error:bool -> ?in_flight_limit:int -> ?initial_burst_size:int -> unit -> tval enqueue_exn : t -> ?allow_immediate_run:bool -> int -> ('a -> unit) -> 'a -> unitenqueue_exn t x f aenqueues an immediate job consumingxtokens, runningfon inputa.if
allow_immediate_runis true thenfis allowed to run within the same async job asenqueue_exniff there are enough tokens available to fully run the job and there are no other previously enqueued jobs that have not run. If this is the case, it is run beforeenqueue_exnreturns. Otherwise no part offis run beforeenqueue_exnreturns.If there is a failure associated with this job then the exception will be raised to the monitor in scope when
enqueue_exnis called. Note that it may fail for a number of reasons, includingfthrows an exception, the limiter is killed, or the number of tokens requested is larger than the burst size.
val enqueue' : t -> int -> ('a -> 'b Async_kernel.Deferred.t) -> 'a -> 'b Outcome.t Async_kernel.Deferred.tenqueue' t x f aenqueues a deferred job consumingxtokens, runningfon inputa. No part of f is run beforeenqueue'returns.
include Common with type 'a t := 'a u
val kill : _ t -> unitkills
t, which aborts all enqueued jobs that haven't started and all jobs enqueued in the future. Ifthas already been killed, then callingkill thas no effect. Note that kill does not affect currently running jobs in any way.
val is_dead : _ t -> boolis_dead treturnstrueiftwas killed, either bykillor by an unhandled exception in a job.