boinkor-net / governor

A rate-limiting library for Rust (f.k.a. ratelimit_meter)
https://github.com/boinkor-net/governor
MIT License
579 stars 45 forks source link

Combining rate limiters #167

Closed jszwedko closed 1 year ago

jszwedko commented 1 year ago

Hey!

We have a use case in https://github.com/vectordotdev/vector/pull/14280 where it would be useful to have multiple rate limiters apply to the same input stream where if any one of them fails to check we consider it limited. The trick is, if one rate limiter fails to take tokens, we don't want to have consumed tokens from the other rate limiters that have been checked (or we want to readd tokens to the checked rate limiter).

Is there a way to do this that I'm missing? Or would this require some changes to this crate?

untitaker commented 1 year ago

duplicate of #156

jszwedko commented 1 year ago

And so it is, thanks @untitaker ! I'll close this one.