-
-
Notifications
You must be signed in to change notification settings - Fork 163
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
add support for redis v4 #176
Conversation
@rahil-p Hey, this is great! However, we can't create other class for this case. This will be confusing for everyone except you and me. |
@rahil-p I believe, RateLimiterRedis can be improved for Yes, it would be not the best code structure and agains some best practice, but |
@animir Thanks for the feedback. I agree that that's the better solution for users of the package. I'm not sure what the best way to approach checking if the provided client is from |
@rahil-p If there is no way to get EDIT: After some thinking |
.pttl(rlKey) | ||
.exec((err, res) => { | ||
if (secDuration > 0) { | ||
const incrCallback = (err, result) => { |
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.
Here's another change that was made by an ESLint autofix (overlooked it by mistake). Please let me know if you'd like me to revert it.
Comparing to base:
- const incrCallback = function(err, result) {
+ const incrCallback = (err, result) => {
Something new? |
@marlonelima Nothing the for the last month. If you wish to help, you can look at these changes and implement redis package v4+ support. Let us know. |
I pushed changes in d110583 that need review. My availability has been limited, so I haven't been able to manually test out these changes. I'd appreciate if someone could give that a go. |
@rahil-p I was just trying to test your changes and I got this error
I did set the client store version to 4: I really do want to use change though, I think it would be really nice since the 3.x version of redis module is very out of date and doesnt even have proper typescript types. |
👋 For what it's worth I just tested this PR and it's working with a basic rate limiting setup, so I don't think it's far off ready and would be really useful to have it merged (especially as it seems it doesn't bring breaking change thanks to
might be worth also adding a section to the Redis wiki to add
|
@manzan46 Hi, a-r-d tested it and found an error a couple of months ago. There were no changes since then. Also, new code requires new tests to be written. Unfortunately, It can't be merged without tests. While this PR looks promising, it can't be merged like this. |
No problems at all, it was mainly to mention on basic usecase I didn't have any issue on my side, and try to get the ball rolling 😅 (definitely better to merge this with test 👌🏻 ) |
Closing this PR. Changes arrived in the scope of other PR #218. Thank you. |
Support of |
Related: #141, #167
This pull request implements
RateLimiterRedisNext
, which is intended to be exclusively compatible with redis v4.x.