Effect CommunityEC
Effect Community2y ago
7 replies
Patrick Roza

Real rate limit reactivity

is anyone using a rate limit response processor with backoffs? so far I've been using naive rate limiters, that just limits calling within some timespan, however this assumes one client, and does not react to server error responses that contain rate limiting hints via headers.
basically it'd be a rate limit, plus retry, with backoff, that understands the response headers and collect outgoing requests until the rate limit timeout has passed again etc

headers
"x-ratelimit-limit-second":"5",
"x-ratelimit-reset-second":"1710238232",
"x-ratelimit-remaining-second":"0",
"retry-after":"1"
429 status response
body
{\"error\":{\"code\":\"rate_limit_reached\",\"message\":\"You have exceeded the maximum rate limitation allowed on your subscription plan. Please refer to the \\\"Rate Limits\\\" section of the API Documentation for details. \"}

I think it's cloudflare default rate limiting.

The idea is to be able to process as many requests as possible while maximising the ratelimit at the 3rd party api.
Was this page helpful?