Introduce a Req.RateLimiter module to fix API rate limit issues

This commit is contained in:
Claudio Ortolina
2026-03-02 15:04:45 +00:00
parent 99674eb8bc
commit a992c1f0dd
14 changed files with 211 additions and 37 deletions
+1
View File
@@ -146,6 +146,7 @@ defmodule LastFm.API do
user_agent: config.user_agent
)
|> Req.Request.merge_options(config.req_options)
|> Req.RateLimiter.attach(name: :last_fm, cooldown: config.api_cooldown)
|> Req.Request.put_private(:api_key, config.api_key)
|> Req.Request.append_request_steps(log_attempt: &log_attempt/1)
|> Req.Request.append_response_steps(parse_error: &parse_error/1)