We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
async.times
When I tested the limiter with the code below
var redis = require('ioredis'), Limiter = require('ratelimiter'), async = require('async'), db = redis.createClient(), limiter; limiter = new Limiter({ id: 'hello', db: db }); async.times(10, function(n, next) { limiter.get(next); }, function(err, res) { console.log(res); });
It printed the following
[ { total: 2500, remaining: 2500, reset: 1485859856 }, { total: 2500, remaining: 2499, reset: 1485859856 }, { total: 2500, remaining: 2499, reset: 1485859856 }, { total: 2500, remaining: 2499, reset: 1485859856 }, { total: 2500, remaining: 2499, reset: 1485859856 }, { total: 2500, remaining: 2499, reset: 1485859856 }, { total: 2500, remaining: 2499, reset: 1485859856 }, { total: 2500, remaining: 2499, reset: 1485859856 }, { total: 2500, remaining: 2498, reset: 1485859856 }, { total: 2500, remaining: 2498, reset: 1485859856 } ]
Probably due to n value not getting updated. Sent a pr to try fixing this issue. Comments are appreciated.
pr
The text was updated successfully, but these errors were encountered:
Race condition when using async.times. fixes #29 by @kp96
e45864b
520eeff
No branches or pull requests
When I tested the limiter with the code below
It printed the following
Probably due to n value not getting updated. Sent a
pr
to try fixing this issue. Comments are appreciated.The text was updated successfully, but these errors were encountered: