Token-bucket rate limiter for the Marqeta API.
Maintains per-category token buckets. When a bucket is empty, callers block until tokens refill on the next 100 ms tick.
Buckets
| Bucket | Default RPS | Burst |
|---|---|---|
:default | 50 | 100 |
:diva | 20 | 50 |
:simulations | 10 | 20 |
The limiter is started automatically by Marqeta.Application and is
called by Marqeta.Client before every outbound request.
In tests the GenServer is not started so the call is a no-op.
Summary
Functions
Acquires a rate-limit token for the given path.
Returns a specification to start this module under a supervisor.
Functions
@spec check_rate_limit(String.t()) :: :ok
Acquires a rate-limit token for the given path.
Blocks (up to 10 s) if the relevant bucket is empty.
Returns :ok once a token has been acquired.
Returns a specification to start this module under a supervisor.
See Supervisor.
@spec start_link(term()) :: GenServer.on_start()