package devkit

  1. Overview
  2. Docs
Development kit - general purpose library

Install

dune-project
 Dependency

Authors

Maintainers

Sources

1.20261006.tar.gz
md5=a39dbbce04bd5562a9b4443daf39c582
sha512=b10104b61384b2151521b785e7f3c3250134c75eae09b42cad69bc4a22a9a5e429beb891ee87cedf376c23d9c40f09d3f71c3fd48aa35df490c0f69dc17f3242

doc/devkit.core/Devkit_core/Control/Rate_limit/index.html

Module Control.Rate_limitSource

Sourcetype t
Sourceval unlimited : t
Sourceval create : ?burst_factor:int -> allowed_per_sec:float -> unit -> t

Create a token-bucket rate limiter. The bucket starts full.

  • parameter burst_factor

    limits the maximum size of a burst of activity as a factor of the base rate limit.

  • parameter allowed_per_sec

    sustained number of operations allowed per second, ie asymptotic maximum rate.

Sourceval take_rate_limited_count : t -> int

How many attempts have been rate limited since last time this was called?

Sourceval attempt : t -> bool

Attempt to perform one action. Return true if allowed by rate limiter.