module

RateLimiter::LimiterLike

Defines the API for a rate-limiter-like instance.

Instance methods

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
get!(max_wait : Time::Span) : Token

Raises RateLimiter::Timeout if no token is available after the given time span. Blocking for at most a max_wait duration.

Source
get!

Raises RateLimiter::Timeout if no token is available at call time. Non-blocking.

Source
get?

Returns nil if no token is available at call time. Non-blocking.

Source