-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
time: fix time::advance() with sub-ms durations #3852
Conversation
Does this PR affect #3763? |
It should not. |
Update the advance logic to factor in the timer's ms rounding. Fixes #3837
I rebased on 1.6.x so that this can go out as a patch, once it is ready. |
Co-authored-by: sb64 <53383020+sb64@users.noreply.github.com>
Pushed a change. Instead of using a sleep in |
Applied feedback. |
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.
Looks good to me!
These don't actually *need* to advance the mock clock --- they are just intended to make the current task yield so the background task can observe updates. Replacing them with `yield_now` expresses intent more accurately. Also, this seems to fix the test failing after upgrading to tokio 1.6.2+, presumably related to tokio-rs/tokio#3852. I'm still trying to figure out _why_ exactly this fixes the test (and why it breaks in the first place), but at least this PR will get CI passing on Tokio 1.7.0. See here for details: #1079 (comment)
These don't actually *need* to advance the mock clock --- they are just intended to make the current task yield so the background task can observe updates. Replacing them with `yield_now` expresses intent more accurately. Also, this seems to fix the test failing after upgrading to tokio 1.6.2+, presumably related to tokio-rs/tokio#3852. I'm still trying to figure out _why_ exactly this fixes the test (and why it breaks in the first place), but at least this PR will get CI passing on Tokio 1.7.0. See here for details: #1079 (comment)
Update the advance logic to factor in the timer's ms rounding.
Fixes #3837