#Getting 429'd for several hours

3 messages · Page 1 of 1 (latest)

tribal quail
#

repmk (https://github.com/mikeb26/chesstools/tree/main/cmd/repmk) is a command line tool for building chess opening repertoires. It combines analysis data from https://lichess.org/api#tag/Analysis, local stockfish evals, and data from the opening explorer (https://lichess.org/api#tag/Opening-Explorer). When users run it the API traffic tends to be bursty in nature followed by long periods of idleness. For a given a position it will check the opening explorer for the top replies and then for each reply check the analysis data to get the evaluation of the position with that reply.

I have implemented rate limiting according to the documentation here:

https://lichess.org/page/api-tips
https://lichess.org/api#section/Introduction/Rate-limiting

e.g. https://github.com/mikeb26/chesstools/blob/main/openings.go#L397-L409

However, despite this at times I find that the lichess API will just return nothing but 429 for several hours. So I would guess somewhere I'm unintentionally tripping a DDoS protection mechanism and getting firewalled. Can lichess please advise on what I can additionally do to avoid this? Please let me know if you need additional information.

lilac totem
#

As long as you wait at least a minute on a 429, you won't get blocked.
If you ignore 429, you will be blocked (i.e, no respose at all).
So if you are receiving 429s, it means you've depleted your allowed requests.
Some endpoints have a limit for a time period.
For example 100 requests per 24 hours.
If you use 100 requests during the first hour, you will get 429s during the rest 23 hours.

#

Sometimes the limits are documented in API documentation, but often they are not documented.
You could try to read the source code and try to figure out what the limits are for the endpoints you are using - I think they are calculated with concepts of dynamic costs.
Maybe you could run a local Lichess instance to experiment with the limits - it's possible to disable limits (good while developing) and enable limits (good while testing limits) - with for instance this setup: https://github.com/lichess-org/lila-docker

GitHub

Lichess local development using Docker Compose. Contribute to lichess-org/lila-docker development by creating an account on GitHub.