class

RateLimiter::Limiter

Inherits RateLimiter::LimiterLike / Reference / Object

A rate limiter erogating tokens at the specified rate.

This is powered by the token bucket algorithm.

Constructors

new(rate : Float64, max_burst : Int32 = 1)
Source

Instance methods

bucket
Source
get(max_wait : Time::Span) : Token | Timeout

Returns a Token if one is available within max_wait time, otherwise it returns a Timeout. Blocking.

Source
get

Returns a Token as soon as available. Blocking.

Source
rate
Source