Skip to content

429 Reponses

Ollie Jennings edited this page Sep 10, 2020 · 1 revision

What is a 429 Reponse?

This is the statusCode of the response from the Riot API for when we have hit a rate limit. The rate limit hit should be available in the X-Rate-Limit-Type header, being either application, method or service. There are times when we will not receive the rate limit type header, and therefore we can safely assume it is some underlying piece of infrastructure.

In theory we should always avoid getting 429 responses, as this could potentially lead to our API Token being blacklisted, hence the purpose of this library.

What do we do in the event of a 429?

If we do get a 429 we should check for the Retry-After header, which contains the time in seconds we should wait until we make another request. If in the event of the Retry-After header missing, we use a default of 5 seconds* before making any subsequent requests.

When the rate-limiter receives a 429 response, it will update all of the affected limiters with the latest rate limits, so that we can synchonrise and prevent any other requests being sent until we are no longer breaching the rate limits.

Do you auto-retry requests that receive a 429 response?

Yes we do, we will retry all requests that receive a 429 response, but only up until a limit (you can modify) which can be found here. We will retry the request an additional 3 times, if the request continues to fail after that, we then throw the error.