resty icon indicating copy to clipboard operation
resty copied to clipboard

Add rate limiter to client

Open dbriemann opened this issue 3 years ago • 1 comments

Add a simple per client rate limiting based on golang.org/x/time/rate.

dbriemann avatar Nov 30 '21 21:11 dbriemann

@jeevatkm Could you please check this? it would be great to have integrated rate limiter

SVilgelm avatar Mar 11 '22 19:03 SVilgelm

So it looks ok, what needs to be done to finish this? I can help.

janekolszak avatar Nov 10 '22 07:11 janekolszak

@dbriemann I'm sorry for the delayed attention on the PR. Your feature proposal make sense, do you mind preparing the PR for review with tests & validation build success?

jeevatkm avatar Mar 06 '23 00:03 jeevatkm

I am very busy these days but I can have a look in the near future what exactly there is left to do.

dbriemann avatar Mar 09 '23 18:03 dbriemann

I am very busy these days but I can have a look in the near future what exactly there is left to do.

@dbriemann Thanks for getting back.

jeevatkm avatar Mar 11 '23 08:03 jeevatkm

OK I found some time to update this today. It is a very simple rate limiter which returns an ErrRateLimitExceeded on an execute that exceeds the limit. There are no automatic retries. The user has to handle these accordingly.

Not sure how good the API is. Just give it a review.

dbriemann avatar Mar 24 '23 20:03 dbriemann

@dbriemann My apologies for the late. I have thought about it. Adding an interface contract into Resty will provide options for the users to any rate limiter or their version instead of integrating the library golang.org/x/time/rate.

In this PR, you have used the Allow() method from the available library options; I think we can start with this one method as a contract.

Are you interested in taking it up? Please let me know.

jeevatkm avatar Sep 17 '23 07:09 jeevatkm

has been merged in #715, can be closed

SVilgelm avatar Sep 30 '23 16:09 SVilgelm

Of-course @SVilgelm

jeevatkm avatar Oct 01 '23 01:10 jeevatkm