clearlydefined / service

The service side of clearlydefined.io
MIT License
45 stars 40 forks source link

API is returning 429s when the rate-limit has not been reached #935

Open disulliv opened 2 years ago

disulliv commented 2 years ago

There's 2 rate limiters, one of all APIs, then another for Batch APIs.

Sometimes we'll get 429 requests before we hit the limit of 1000 requests per minute, even as low as 200 requests/minute across multiple APIs, need to investigate why.

lamarrr commented 9 months ago

For me to investigate this can you give a clearer description of the issue as I have no idea of the context and which specific APIs

lamarrr commented 9 months ago

I've done some digging and I think it has to do with the environment config. what parameters are you using for your environment config? please post them here. note that it is requests per time-limit window. my guess is that it has been configured incorrectly.

the correct config for your requirements is:

{
"RATE_LIMIT_MAX": 1000,
"RATE_LIMIT_WINDOW": 3600,
"BATCH_RATE_LIMIT_MAX": 250,
"BATCH_RATE_LIMIT_WINDOW": 3600
}