Tinkex.RateLimiter (Tinkex v0.3.4)
View SourceShared backoff state per {base_url, api_key} combination.
Summary
Functions
Clear any active backoff window.
Get or create the limiter for a {base_url, api_key} tuple.
Set a backoff window in milliseconds.
Determine whether the limiter is currently in a backoff window.
Block until the backoff window has passed.
Types
@type limiter() :: :atomics.atomics_ref()
Functions
@spec clear_backoff(limiter()) :: :ok
Clear any active backoff window.
Get or create the limiter for a {base_url, api_key} tuple.
@spec set_backoff(limiter(), non_neg_integer()) :: :ok
Set a backoff window in milliseconds.
Determine whether the limiter is currently in a backoff window.
@spec wait_for_backoff(limiter()) :: :ok
Block until the backoff window has passed.