-
-
Notifications
You must be signed in to change notification settings - Fork 36
Fix TTL=0 race: start new window at 1 atomically in Lua #218
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
- Update the increment script to handle expiration and reset conditions more effectively. - Introduce parameters for window duration and reset behavior, enhancing script functionality.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you, this is great work!
| local windowMs = tonumber(ARGV[2]) | ||
| local resetOnChange = ARGV[1] == "1" | ||
| return { totalHits, timeToExpire } | ||
| local timeToExpire = redis.call("PTTL", KEYS[1]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for making these named variables, we should have done that a while ago.
|
This does look like a much better fix than the original one, and it looks like I was wrong with my initial thinking that this was an unrelated issue. I think using the Lastly, the linter is complaining about formatting - run Then I can merge it in a publish a new release. |
- Add Redis 2.6.12 minimum version requirement to README - Fix prettier formatting issues in table
|
Ok, CI should publish v4.2.3 to NPM shortly. Thanks, again! |
|
Hey @mt-ks you did an awesome job on this PR; would you like to be added to this repo as a co-maintainer with @gamemaker1 and myself? (And @wyattjoh who is the original author but no longer as involved in the project.) We have a couple of changes planned (include a default redis library, & deprecate resetExpiryOnChange), and you'd be welcome but not obligated to take that on. My thinking is more that it would be beneficial to have someone involved who is currently using the library, in order to better anticipate and respond to issues. |
|
Hi @nfriedly First of all, thank you |
|
Awesome, I just sent you an invite |
|
Welcome on board @mt-ks! Looking forward to working with you :) |

Issue SS