class RateLimiter::MultiLimiter

Overview

A rate limiter combining multiple Limiters.

A MultiLimter tries to acquire tokens from limiters producing at the lowest rate first. This mitigates the scenario where tokens are acquired and then wasted due to a single rate limiter timing out.

Included Modules

Defined in:

rate_limiter.cr

Constructors

Instance Method Summary

Instance methods inherited from module RateLimiter::LimiterLike

get(max_wait : Time::Span) : Token | Timeout
get : Token
get
, get!(max_wait : Time::Span) : Token
get! : Token
get!
, get? : Token | Nil get?

Constructor Detail

def self.new(*rate_limiters : Limiter) #

[View source]

Instance Method Detail

def get(max_wait : Time::Span) : Token | Timeout #
Description copied from module RateLimiter::LimiterLike

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


[View source]
def get : Token #
Description copied from module RateLimiter::LimiterLike

Returns a Token as soon as available. Blocking.


[View source]