alisaifee / limits

Rate limiting using various strategies and storage backends such as redis & memcached
https://limits.readthedocs.org
MIT License
423 stars 58 forks source link

add namespace param to reset func #173

Closed lzgirlcat closed 11 months ago

lzgirlcat commented 1 year ago

add namespace param to reset func

codecov[bot] commented 1 year ago

Codecov Report

Patch coverage: 100.00% and no project coverage change.

Comparison is base (9a98ac2) 96.58% compared to head (f2fad7a) 96.58%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #173 +/- ## ======================================= Coverage 96.58% 96.58% ======================================= Files 25 25 Lines 1173 1173 Branches 127 127 ======================================= Hits 1133 1133 Misses 20 20 Partials 20 20 ``` | [Files Changed](https://app.codecov.io/gh/alisaifee/limits/pull/173?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Ali-Akber+Saifee) | Coverage Δ | | |---|---|---| | [limits/aio/storage/redis.py](https://app.codecov.io/gh/alisaifee/limits/pull/173?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Ali-Akber+Saifee#diff-bGltaXRzL2Fpby9zdG9yYWdlL3JlZGlzLnB5) | `93.66% <100.00%> (ø)` | | | [limits/storage/redis.py](https://app.codecov.io/gh/alisaifee/limits/pull/173?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Ali-Akber+Saifee#diff-bGltaXRzL3N0b3JhZ2UvcmVkaXMucHk=) | `95.71% <100.00%> (ø)` | | | [limits/storage/redis\_cluster.py](https://app.codecov.io/gh/alisaifee/limits/pull/173?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Ali-Akber+Saifee#diff-bGltaXRzL3N0b3JhZ2UvcmVkaXNfY2x1c3Rlci5weQ==) | `95.83% <100.00%> (ø)` | |

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

alisaifee commented 1 year ago

First up, apologies for the very delayed feedback.

Changing the signature of the reset method only for redis related storages isn't the right way to go as it breaks the contract from the abstract base class (reference).

An alternate approach would you consider adding namespace as an optional argument to the constructors of the redis storage classes and that namespace could be used by the reset methods.

alisaifee commented 11 months ago

I believe #183 provides a sufficient solution to what this PR was trying to solve.