You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Sep 26, 2023. It is now read-only.
I've discovered the algorithm implemented in LeakyBucketStrategy is far from accurate. Using limits of 3/10s, 10/1h, and 25/day all seem to function correctly. However anything quicker than 1/s is very inaccurate.
I'm struggling to identify the issue. Can you provide any reference for where this algorithm came from? It appears that there are significant floating point rounding errors when trying to implement faster rates. I suspect the following line is the issue:
I've discovered the algorithm implemented in LeakyBucketStrategy is far from accurate. Using limits of 3/10s, 10/1h, and 25/day all seem to function correctly. However anything quicker than 1/s is very inaccurate.
I'm struggling to identify the issue. Can you provide any reference for where this algorithm came from? It appears that there are significant floating point rounding errors when trying to implement faster rates. I suspect the following line is the issue:
https://github.com/beheh/flaps/blob/master/src/Flaps/Throttling/LeakyBucketStrategy.php#L153
How to reproduce: