Skip to content
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

quota apply w/ weight == 0 actually applies 1 #33

Open
theganyo opened this issue Aug 23, 2014 · 4 comments
Open

quota apply w/ weight == 0 actually applies 1 #33

theganyo opened this issue Aug 23, 2014 · 4 comments

Comments

@theganyo
Copy link
Contributor

  1. Can all providers support actually processing weight == 0? Do we want to?
  2. The actual use case was just wanting to retrieve quota statistics. Can this be exposed directly?
@freezy
Copy link
Contributor

freezy commented Oct 25, 2015

Just stumbled across this. I need to know stats without consuming anything. Now, I can apply -1 followed by 1, but that's really ugly. Are there any better workarounds?

EDIT: Actually, sending -1 seems to reset the remaining time, so this doesn't work either.

@theganyo
Copy link
Contributor Author

Hi @freezy,

Sorry you're hitting this. Unfortunately, changing the default behavior could be a breaking change for some clients, so nothing had been decided on this yet. Could you let me know a little bit more about what you're doing? What provider? What quota settings?

Thanks, Scott

@freezy
Copy link
Contributor

freezy commented Oct 26, 2015

Well, I'm about to add a status page for the users so they can see how many hits they have left for the current time window and how long it lasts. So I just need to query the data without touching the stats.

I'm using volos-quota-redis for this. I had a look at the code and saw that when Redis returns -1, it's actually interpreted as "value not added", so adding -2 followed by +2 finally did the trick. Makes it even uglier though.

Another way I could imagine would be querying Redis myself, but then that'll break when you guys change your internal API.

@theganyo
Copy link
Contributor Author

theganyo commented Nov 5, 2015

I agree, it's ugly. Unfortunately, I can't offer a better solution at this point.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants