mennanov / limiters

Golang rate limiters for distributed applications
https://godoc.org/github.com/mennanov/limiters
MIT License
458 stars 49 forks source link

Add redsync Mutex options for LockRedis and use context in LockRedis #31

Closed GRbit closed 9 months ago

GRbit commented 9 months ago

Hi @mennanov !

Thank you very much for the great library, great Token Bucket and Leaky Bucket implementations!

I wan to suggest a little 100% backward compatible improvement to allow a better control on mutexes in Redis. By default redsync have a delayFunc which automatically unlocks mutex if it wasn't acquired in a few seconds. For my case of limiters usage I need to have more control on this.

Feel free to ask me about any changes or change the code yourself the way you like.

I wish all the best, especially continued success in developing open-source projects!

codecov[bot] commented 9 months ago

Codecov Report

Attention: 1 lines in your changes are missing coverage. Please review.

Comparison is base (b9fb5f6) 83.00% compared to head (f9da9b2) 83.00%.

Files Patch % Lines
locks.go 83.33% 0 Missing and 1 partial :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #31 +/- ## ======================================= Coverage 83.00% 83.00% ======================================= Files 10 10 Lines 1183 1183 ======================================= Hits 982 982 Misses 137 137 Partials 64 64 ```

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

mennanov commented 9 months ago

Thanks for contributing!