Minimal token-bucket rate limiter backed by a GenServer.
ClearBank returns 429 responses when rate limits are exceeded.
This module provides a lightweight client-side guard you can opt into
by calling ClearBank.RateLimiter.check_rate/1 in your application layer.
Limits are dynamic per ClearBank's docs and significantly lower in simulation.
You should always handle 429 responses from the server regardless.
Summary
Functions
Checks and consumes a rate-limit token. Returns :ok or {:error, :rate_limited}.
Returns a specification to start this module under a supervisor.
Functions
@spec check_rate(pos_integer()) :: :ok | {:error, :rate_limited}
Checks and consumes a rate-limit token. Returns :ok or {:error, :rate_limited}.
Returns a specification to start this module under a supervisor.
See Supervisor.