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

Limit actually limits to one less #3

Open
cadecairos opened this issue Sep 2, 2014 · 4 comments
Open

Limit actually limits to one less #3

cadecairos opened this issue Sep 2, 2014 · 4 comments

Comments

@cadecairos
Copy link

if (limit.remaining) return next()

You will always be limited to one less than the limit you set. For example, if I set limit to 1 it will decrement remaining, save the JSON to Redis, and then once it hits the line above, remaining will be 0 and it sends a 429 response.

cadecairos pushed a commit to cadecairos/express-limiter that referenced this issue Sep 2, 2014
@tciuro
Copy link

tciuro commented Apr 26, 2015

@cadecairos why don't you add a pull request?

@cadecairos
Copy link
Author

I was planning on it, but never had a chance. I'll see if I can help out next time I'm at my computer :)

@cadecairos
Copy link
Author

Hahahaha I did submit a patch, it's #4

@tciuro
Copy link

tciuro commented Apr 27, 2015

Awesome. Thanks! ;-)

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

No branches or pull requests

2 participants