bharel / asynciolimiter

A simple yet efficient Python AsyncIO rate limiter.
MIT License
13 stars 2 forks source link

Allow setting max_burst when instantiating the Limiter #6

Closed michcio1234 closed 1 year ago

michcio1234 commented 1 year ago

max_burst is now an argument to Limiter.__init__.

Tests and docs were adjusted accordingly.

By the way, thanks for the great package. :)

michcio1234 commented 1 year ago

@bharel updated. 👍🏻 I definitely agree with your comments. I believe this simpler version is better. Initially I just wanted to stay consistent with existing code. :)

bharel commented 1 year ago

Awesome!

The code is already consistent with past versions of course and with the other classes, as it's a public attribute :-)

If you're referring to rate being a property then you'll see it has a tiny bit of logic for runtime optimization.

Last but not least, we need to update the documentation to account for the new __init__. See how LeakyBucket looks like in index.rst.

codecov-commenter commented 1 year ago

Codecov Report

Base: 100.00% // Head: 100.00% // No change to project coverage :thumbsup:

Coverage data is based on head (27a26af) compared to base (bff0e4c). Patch coverage: 100.00% of modified lines in pull request are covered.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #6 +/- ## ========================================= Coverage 100.00% 100.00% ========================================= Files 2 2 Lines 581 583 +2 Branches 41 42 +1 ========================================= + Hits 581 583 +2 ``` | Flag | Coverage Δ | | |---|---|---| | unittests | `100.00% <100.00%> (ø)` | | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Bar+Harel#carryforward-flags-in-the-pull-request-comment) to find out more. | [Impacted Files](https://codecov.io/gh/bharel/asynciolimiter/pull/6?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Bar+Harel) | Coverage Δ | | |---|---|---| | [asynciolimiter.py](https://codecov.io/gh/bharel/asynciolimiter/pull/6/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Bar+Harel#diff-YXN5bmNpb2xpbWl0ZXIucHk=) | `100.00% <100.00%> (ø)` | | | [tests.py](https://codecov.io/gh/bharel/asynciolimiter/pull/6/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Bar+Harel#diff-dGVzdHMucHk=) | `100.00% <100.00%> (ø)` | | Help us with your feedback. Take ten seconds to tell us [how you rate us](https://about.codecov.io/nps?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Bar+Harel). Have a feature suggestion? [Share it here.](https://app.codecov.io/gh/feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Bar+Harel)

:umbrella: View full report at Codecov.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.

michcio1234 commented 1 year ago

Nice, thank you! :)