Fixes out-of-sync TTLs after running decr()#13
Conversation
|
Thanks @kwizzn. seems weird that we missed it. I will dig deeper soon. |
|
It is easy to reproduce if you trigger lots of requests around the second when the limit period ends. You'll have a timespan of around 300 ms (probably depending on your Redis) where you get new keys with limit & reset equalling 0. |
|
Looks good. thanks @kwizzn |
|
I was looking into this and it turned out my problem was unrelated. But it's worth pointing out this uses the client date time instead of using the date time on the redis instance. I suspect it would be preferable to use the date time on redis as the client clocks can skew. That is a big can of worms though but just wanted to mention it in case someone hits it. |
|
@cymen when you say client you mean a server that uses redis-client? I believe that if someone changes the server time, he could also change the redis server time, right? |
Thanks for a great module! I would like to contribute a fix & test related to TTLs that run out of sync when the decr() function updates the count, leaving it with a different TTL than limit & reset.