Henrik-3 / unofficial-valorant-api

Unofficial VALORANT API using the VALORANT Ingame API
442 stars 19 forks source link

Accounts return 429, (sometimes?) #35

Closed briantoe closed 2 years ago

briantoe commented 2 years ago

So I'm receiving this response after hitting any endpoint with the username=TWICE and tagline=once2. It'll return this response which I haven't been able to find documented anywhere in this repository:

{
  status: 429,
  data: {
    status: '429',
    message: 'Source Server Rate Limit, try again later'
  },
  ratelimits: { used: '5', remaining: '245', reset: '199' },
  error: null
}

This issue isn't specific to this account, I've seen this happen with some other accounts that I've tried to pass to your API.

Strangely enough, I checked in after about an hour and the endpoint works fine now. I'm curious about what is causing this to happen.

Thank you so much for building this API and maintaining it!

Henrik-3 commented 2 years ago

Hey, this issue happens because the backend of the api is only able to get 30 new accounts that are not in the database in 2min, when the limit is reached it will automatically return a 429. Sadly, there is for now no production ready alternative which mean that i can't simply add another system to get the puuid and with that puuid the data that is requested

briantoe commented 2 years ago

So does the backend crawl and add 30 new accounts every 2 min or does the backend add a new account whenever someone requests an account the backend doesn't have in the database yet?

Henrik-3 commented 2 years ago

On request, means when to many other people try to get uncached accounts it may be the case that u receive a 429. I already implemented that new accounts are added on match request (that all 10/14 players from the match will be added or updated) with which I added around 750k new accounts (last time I checked 3 days ago) to the db which is for sure not enough to have a big impact on the overall 429 and loading time issues but it is a start. I could push that even further when I fetch the matchhistory from every player in the game and then fetch all the games every player has in their history but that needs a lot of preparation