Skip to content

Bug in computing blockId  #35

@abhigun

Description

@abhigun

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions