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

Bug in computing blockId #35

Open
abhigun opened this issue Jan 24, 2020 · 0 comments
Open

Bug in computing blockId #35

abhigun opened this issue Jan 24, 2020 · 0 comments

Comments

@abhigun
Copy link

abhigun commented Jan 24, 2020

The computation of blockId is as follows:
blockId = Math.floor(time_now/precision);

Currently, while computing the blockId in all the test cases the BanditSupplier starts the timer at perfectly rounded count of 1000000. So whenever a delta time is added to this count the blockId works as expected.

Consider the following situation:
If the BanditSupplier was started with a counter of 1000007 and the Ratelimiter rule of (duration=10sec, limit = 5, precision = 10).
The window starts with the blockId of (1000007/10) i.e 100000

With an elapse of 3 seconds, the timer count now is 1000010 and the corresponding blockId is 100001 which results in a different window and defeats the purpose of FixedWindowRateLimiting

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

1 participant