-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[RateLimiter] Add support for long intervals (months and years) #43060
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
[RateLimiter] Add support for long intervals (months and years) #43060
Conversation
bed13d3
to
fcfde37
Compare
Tests please. 🙂 |
@derrabus indeed! Wasn't sure which tests to add though. But I'll definitely try to find some! 😄 |
Well, you should be able to come up with a test that fails on 5.4 and passes after your changes. After all, you're fixing a problem here. 😎 |
Oh yeah of course you're right! Just added them. If you see anything else, please tell me! Speaking of that, should this be rebased to 5.3 as a bug fix or is it considered as a feature and 5.4 is fine? |
fcfde37
to
dd44a83
Compare
That’s a new feature |
a3bcb2b
to
a1d2d61
Compare
|
||
yield ['PT2H4M', 2 * 3600 + 4 * 60]; | ||
|
||
yield ['P1Y', 24 * 3600 * 365]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would expect that this test will start to fail on March 1st, 2023. 🤓
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm struggling a bit with these tests, as months and years, of course, may have different number of days. Any advice welcome about this one!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the variable length of the limit desired? So far, the rate limiter worked with fixed lengths, IIRC. We would change that now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm wondering if it's worth testing this method doing a simple timestamp operation. What I mean is if it changes, FixedWindowLimiter
tests and similar will break, as I updated FixedWindowLimiterTest
with long intervals too.
The lack of tests on TimeUtil
currently makes me wonder even more.
@@ -5,6 +5,7 @@ CHANGELOG | |||
--- | |||
|
|||
* The component is not experimental anymore | |||
* Add support of long intervals (months and years) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* Add support of long intervals (months and years) | |
* Add support for long intervals (months and years) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Of course, fixed. Thanks, Oskar!
a1d2d61
to
342164e
Compare
Thank you @alexandre-daubois. |
As mentioned in the issue and as found on Stackoverflow, we may use timestamps instead of converting
DateInterval
properties to seconds.