-
Notifications
You must be signed in to change notification settings - Fork 32
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
APIs to reset consumed tokens and get remaining tokens #84
APIs to reset consumed tokens and get remaining tokens #84
Conversation
@sourabpramanik is attempting to deploy a commit to the Upstash Team on Vercel. A member of the Team first needs to authorize it. |
Looks good, and let's add a reset button to next.js example |
For the get remaining API, do you guys have any suggestions for the implementation? I am trying to figure out a way where every algorithm will have their own method to retrieve the remaining tokens because the data type for each algorithm is different. So please let me know if you have any better ideas. |
I believe that as long as the commands remains in Lua script, it should be acceptable. We don't want to cause more round-trips than necessary. |
@ogzhanolguncu @enesakar These are my proposed changes, the implementation of the algorithm does not change just that I have changed the Algorithm function return signature so that we can add get remaining tokens API for each different window as they use different methods to store tokens in Redis. Changes applied to single region fixed window algorithm |
Why do we expose I think initializer config signature should be the same. It's a bit confusing both for the users and devs. Imagine firing up your intellisense and seeing We should find another way to append |
The signature doesn't have to be like this it can work like it used to do by providing the limiter function. I will refactor this |
Yeah I actually missed the intellisense 😅 |
@ogzhanolguncu How about this implementation? |
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.
hi @sourabpramanik,
Thanks a lot for the changes! I think the changes look good overall. I only made a small fix in 4c9002d.
I feel like we can leave the discussion about changing the API for another time.
Thanks @CahidArda |
Yes I believe we can create a new issue for the same and discuss it throughout |
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.
Looks great
This PR adds two new APIs:
Feat: #80