GoCardlessClient.HTTP.RateLimiter (GoCardlessClient v2.0.0)

Copy Markdown View Source

ETS-backed rate-limit state tracker.

Parses X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset headers and stores the latest values per environment for observability.

Summary

Functions

Returns the most recently observed rate-limit state.

Initialises the ETS table. Called by GoCardlessClient.Application.

Updates rate-limit state from response headers.

Functions

get(config)

@spec get(GoCardlessClient.Config.t()) :: map()

Returns the most recently observed rate-limit state.

init()

@spec init() :: :ok

Initialises the ETS table. Called by GoCardlessClient.Application.

update(config, headers)

@spec update(GoCardlessClient.Config.t(), [{String.t(), String.t()}]) :: :ok

Updates rate-limit state from response headers.