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

Burst documentation #184

Closed brprkr closed 1 year ago

brprkr commented 1 year ago

Thanks for this amazing crate!

Struct governor::Quota:

"(..) However, the quota of Quota::per_minute(60) has a burst size of 60 cells, meaning it is possible to accommodate 60 cells in one go, followed by a minute of waiting."

Based on the wording, it may be misunderstood that after the initial burst, the limiter will enforce a one-minute wait, during which time no cells will be allowed through. Would you be willing to consider rephrasing it as: "... meaning it is possible to accomodate 60 cells in one go, after which the equivalent of a minute of inactivity is required for the burst allowance to be fully restored?"

The sentence appearing later makes the intention clear: "In other words, the burst size is the maximum number of cells that the rate limiter will ever allow through without replenishing them." In my opinion it's just hard to parse if you've already misread the above. The misconception may be more likely for users like me approaching from the angle of average/max events per period rather than cell replenishment.

antifuchs commented 1 year ago

You're right, thanks for reading this so closely & for the suggestion! I'll make the docs improvement.

brprkr commented 1 year ago

Thank you!