mennanov / limiters

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

Redis backend with race check bug #41

Closed radandrei closed 4 months ago

radandrei commented 5 months ago

This is a corner case for the issue addressed here: https://github.com/mennanov/limiters/issues/29. This occurs when the version fetched by State() is deleted before SetState() is executed. That will cause an error: got [1 1 OK OK] from redis, expected [<version_before_remove>+1 1 OK OK] raised by checkResponseFromRedis.

Potential solution is to always expect version to be in initial state: https://github.com/mennanov/limiters/pull/42

mennanov commented 4 months ago

Fixed in https://github.com/mennanov/limiters/pull/42