-
Notifications
You must be signed in to change notification settings - Fork 8
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
Fix timer reset()
while it is being waited on
#241
Conversation
Based on #240. The test is flaky, I will update it to remove the flakiness. |
da1fed6
to
140499b
Compare
Updated, hopefully this time it passes all the tests. |
140499b
to
336c437
Compare
#240 merged, rebased. |
Enabled auto-merge, please don't approve if you have suggestions. |
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 have a couple of suggestions to check for. LGTM otherwise
336c437
to
b37aa52
Compare
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.
Just have a question about the missing copyright/license header in the test
b37aa52
to
b6ccfcc
Compare
b6ccfcc
to
886ed11
Compare
tests/test_timer_integration.py
Outdated
@@ -0,0 +1,34 @@ | |||
# License: MIT | |||
# Copyright © 2022 Frequenz Energy-as-a-Service GmbH |
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.
# Copyright © 2022 Frequenz Energy-as-a-Service GmbH | |
# Copyright © 2023 Frequenz Energy-as-a-Service GmbH |
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.
Fixed
This test needs to be an integration test because async-solipsism would make any sleep return immediately, so we wouldn't have a way to do the reset while the timer is being waited on. Signed-off-by: Leandro Lucarella <[email protected]>
If the timer was reset while it was being waited on, the next tick time was not recalculated and the timer would wait for the original time instead of the new one. Signed-off-by: Leandro Lucarella <[email protected]>
Signed-off-by: Leandro Lucarella <[email protected]>
886ed11
to
878ba9b
Compare
If the timer was reset while it was being waited on, the next tick time was not recalculated and the timer would wait for the original time instead of the new one.
This means a timeout could fire even if there was actually no timeout (because the timer was reset).