WebApiThrottle icon indicating copy to clipboard operation
WebApiThrottle copied to clipboard

Rate Limit on excessive errors

Open jasenf opened this issue 2 years ago • 0 comments

Hi,

We have a number of customers who build out client apps to our API and leave unattended for long periods of time. Eventually their calls become problematic for one reason or another and start returning useless data (ex: searching continuously for an item that has been deleted and the search should have stopped.). This is a drain on our database resources and we would like to conditionally rate limit these API calls once a certain threshold of "invalid" calls are mades.

In most cases where this is happening, we catch them with internal customized exceptions (customer doesn't see the exception of course). We would like to use the exception handler to start throttling specific users when the exception count reaches some value. So, if a specific IP address makes a call to our API that is throwing an internal exception 10 times within 5 minutes, we would like to throttle them back and restrict them from making any more calls for the next 20 minutes.

Can WebApiThrottle be extended to easily do this?

jasenf avatar Nov 17 '22 13:11 jasenf