anitya icon indicating copy to clipboard operation
anitya copied to clipboard

Wrong HTTP status code when rate limited

Open maniacmartin opened this issue 1 year ago • 1 comments

When a user is being rate limited, HTTP error 500 ("Internal server error") is returned, along with the text "Rate limit was reached". This is the wrong code, as it's supposed to be used to indicate an issue with the server, but the issue is that the client is sending too many requests. I feel that something like 429 ("Too many requests") would be better. Clients could then match on that and schedule a recheck at a later time, such as with an exponential backoff.

RateLimitException would have to be passed through in anitya/lib/utilities.py instead of being converted to a generic exception (~line 98)

maniacmartin avatar Dec 24 '24 09:12 maniacmartin

If I understand this correctly it is the rate limit on Github you are seeing, not rate limit of Anitya. So returning 429 is not correct as the issue originates somewhere else and not on Anitya side.

There is a ticket open when we want to get this resolved with Github https://github.com/fedora-infra/anitya/issues/1846, but I'm not sure if this will ever be resolved. What we can do with that is to recommend people to not use GitHub backend if the project versions could be obtained somewhere else.

Zlopez avatar Jan 07 '25 12:01 Zlopez