Hacker News new | ask | show | jobs
by rix0r 3849 days ago
I hate that "Too Many Requests", or "Throttled", or what have you, is a 4xx status code.

It renders simple middleware logic like "retry on a 5xx, don't retry on a 4xx" invalid.

If you'd call it "Server Over Capacity" you could just as well argue for a 5xx code.

4 comments

I'm not sure I follow. The client would receive those errors because they are errors on the clients side; the client should ensure that they are not flooding a service other wise the server will cut them off.

Your simple middleware logic is going to have to examine the 400 error in more detail in order to adjust its request rate e.g. exponential back off.

It's not that the "server is over capacity", its that the specific client is making "too many requests".

Usually "Throttled" response carries some information when you can retry. So simple middleware logic to retry with some generic timeout shouldn't be used, instead the response must be analyzed to find out the exact timeout.

Probably it's a thin line between client problem and server problem.

503 = Service unavailable (temporary overload / maintenance)

429 = Too many requests (rate limited)

"429 Too Many Requests" means YOU made too many requests. Retrying will only make it worse. Sounds right to me. You should definitely not simply retry on a 429 response.