Skip to content

Conversation

@evanmcneely
Copy link
Contributor

@evanmcneely evanmcneely commented May 28, 2022

Summary

Token bucket implementation for rate limiting

Refactored algorithm and the tests to use IORedis instead of node-redis. Some of the tests were not behaving the way I believe they were intended to (small typos). I modified the tests with care. Please check the changes and flag any concerns. There is one test that I don't believe is correct and I don't know what the intention was. See line 187 - `token bucket refills at specified rate'

Type of Change

  • New feature (non-breaking change which adds functionality)

Issues

Evidence

Screen Shot 2022-05-29 at 7 09 42 AM

@evanmcneely evanmcneely marked this pull request as ready for review May 29, 2022 12:37
@evanmcneely evanmcneely changed the title Em/token bucket algo Token bucket algorithm May 29, 2022
Copy link
Collaborator

@shalarewicz shalarewicz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work. Only major thing we'll need to consider moving forward is how to handle redis connection failures. Other than that just a few comments on the use of magic numbers.

@evanmcneely evanmcneely merged commit c118dc3 into dev Jun 2, 2022
@evanmcneely evanmcneely deleted the em/tokenBucketAlgo branch June 2, 2022 14:04
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

Successfully merging this pull request may close these issues.

Consider replacing node-redis with io-redis Implement Token Bucket Algorithm

5 participants