Question: Multiple limits
earthiverse opened this issue · 1 comments
earthiverse commented
Is it possible to have two limits?
For example, I want to limit 1 request per second, to a maximum of 1000 per hour.
Can I do that using this package?
earthiverse commented
You can just make two different limits and nest them.
var limiter1 = new RateLimiter(1, 'second')
var limiter2 = new RateLimiter(600, 'hour')
limiter1.removeTokens(1, function () {
limiter2.removeTokens(1, function () {
// Code goes here
})
})