go-resty / resty

Simple HTTP and REST client library for Go
MIT License
9.89k stars 696 forks source link

Add rate limiter to client #715

Closed SVilgelm closed 11 months ago

SVilgelm commented 11 months ago

Add a simple per client rate limiting based on Allow() bool interface

Continue work on https://github.com/go-resty/resty/pull/494

SVilgelm commented 11 months ago

I'm unable to push directly to @dbriemann's PR, so had to create this one. Changed to use an interface instead of x/time/rate, also rebased

codecov[bot] commented 11 months ago

Codecov Report

All modified lines are covered by tests :white_check_mark:

Comparison is base (41199c3) 96.33% compared to head (d8914b2) 96.34%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #715 +/- ## ========================================== + Coverage 96.33% 96.34% +0.01% ========================================== Files 12 12 Lines 1610 1616 +6 ========================================== + Hits 1551 1557 +6 Misses 37 37 Partials 22 22 ``` | [Files](https://app.codecov.io/gh/go-resty/resty/pull/715?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=go-resty) | Coverage Δ | | |---|---|---| | [client.go](https://app.codecov.io/gh/go-resty/resty/pull/715?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=go-resty#diff-Y2xpZW50Lmdv) | `98.04% <100.00%> (+0.02%)` | :arrow_up: | | [util.go](https://app.codecov.io/gh/go-resty/resty/pull/715?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=go-resty#diff-dXRpbC5nbw==) | `94.44% <ø> (ø)` | |

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.