Support IO token bucket capacity > refill rate
This commit is contained in:
parent
8456b6a125
commit
4c9e85b293
4 changed files with 21 additions and 7 deletions
|
|
@ -54,5 +54,13 @@ describe('TokenBucket', () => {
|
|||
assert(!bucket.throttle());
|
||||
assert.strictEqual(bucket.count, 0);
|
||||
});
|
||||
|
||||
it('handles infinite refill rate and capacity', () => {
|
||||
bucket = new TokenBucket(Infinity, Infinity);
|
||||
|
||||
for (let i = 0; i < 100; i++) {
|
||||
assert(!bucket.throttle(), 'should not throttle');
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue