-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Notify task when resetting a Delay to a time in the past #2290
Conversation
5c350bc
to
8bb4f99
Compare
Just a heads up that CI uses this rustfmt command: |
8bb4f99
to
26ae1b5
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.
Looks good.
@thomaswhiteway If you can fix the merge conflict on this it should be good to go. Sorry this has not merged yet! |
26ae1b5
to
90b49c9
Compare
If a Delay has been polled then the task that polled it may be waiting for a notification. If the delay gets reset to a time in the past, then it immediately becomes elapsed, so should notify the relevant task.
90b49c9
to
c5fa4bf
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.
Thanks!
If a Delay has been polled then the task that polled it may be waiting
for a notification. If the delay gets reset to a time in the past, then
it immediately becomes elapsed, so should notify the relevant task.
Motivation
Under certain conditions
DelayQueue
may update the current deadline to be in the past. The delay would immediately transition to elapsed, but wouldn't notify the appropriate task so the scheduler would never re-poll it.Solution
When resetting the time on a
Delay
, if theEntry
is transitioning intoELAPSED
state call the waker to wake any registered task.