Client-side token-bucket rate limiter.
Prevents the client from exceeding rate_limit_rps requests per second,
providing a first line of defence before Railsr returns a 429.
The bucket refills continuously. If the bucket is empty,
check_and_consume/0 returns {:error, :rate_limited}.
Summary
Functions
Attempt to consume one token from the bucket.
Returns a specification to start this module under a supervisor.
Start the rate limiter process.
Functions
@spec check_and_consume() :: :ok | {:error, :rate_limited}
Attempt to consume one token from the bucket.
Returns :ok if the request should proceed,
{:error, :rate_limited} otherwise.
Returns a specification to start this module under a supervisor.
See Supervisor.
@spec start_link(keyword()) :: GenServer.on_start()
Start the rate limiter process.