Animechan-API/animechan

showing too many requests error on hitting this url - "https://animechan.xyz/api/random", status code:429

Closed this issue · 9 comments

@rocktimsaikia please check.

Hello @Rigved29

It is most likely the rate limit

As @lennyAiko said, it's an API limitation.

As I've used the API, I've noticed that the maximum of 100 requests per hour is for ALL clients. So, if @Rigved29 and I made a request at the same time, the API would count it as 2 of the 100 requests allowed. But, I'm not sure of this information since we don't have access to the source code.

@rocktimsaikia, could you verify my theory?

If that's true, that's why "Too many requests" happens quite often.

Yes. That's true. it's documented on the website also. This rate limit is required since this is a free service but running at my own cost on AWS.

image

Thank you for your reply. Please know that you can count on our support, @rocktimsaikia

The rate limit refactoring was done by @melosh101 later in Animechan's private backend repo. since I am quite busy these days, maybe he can look into the issue you mentioned above:

I made a request at the same time, the API would count it as 2 of the 100 requests allowed

FYI, the whole codebase is public now.

after some investigation it looks like when it backend source was released to the public ratelimits where disabled, ill be looking into re-implementing ASAP, might be my christmas present to the world

@melosh101 I totally missed that. That rate-limit is very important tbh. Can you implement a basic rate-limit with something like https://www.npmjs.com/package/koa-ratelimit with system memory for now. Later we can move to a remote Redis host. Also no need for token-based ratelimit logic for now.

@rocktimsaikia Ill look into it, but its getting late here, it's 5am 😅

This should be fixed now. Closing for now