-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
time: delay the cancellation of timers #7467
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
base: master
Are you sure you want to change the base?
Conversation
c2d5790
to
d04c22f
Compare
@@ -522,43 +514,6 @@ async fn insert_after_ready_poll() { | |||
assert_eq!("3", res[2]); | |||
} | |||
|
|||
#[tokio::test] | |||
async fn reset_later_after_slot_starts() { |
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.
Note
This test was removed because it was testing the behavior of tokio::runtime::time::entry::reset
, which is removed in this PR.
@@ -584,43 +539,6 @@ async fn reset_inserted_expired() { | |||
assert_eq!(queue.len(), 0); | |||
} | |||
|
|||
#[tokio::test] | |||
async fn reset_earlier_after_slot_starts() { |
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.
Note
This test was removed because it was testing the behavior of tokio::runtime::time::entry::reset
, which is removed in this PR.
@@ -221,7 +219,7 @@ async fn reset_much_later() { | |||
|
|||
sleep(ms(20)).await; | |||
|
|||
assert!(queue.is_woken()); | |||
assert_ready_some!(poll!(queue)); |
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.
Note
queue.reset_at
resets inner Sleep
, however, the new implementation will drop the inner timer and create a new one. So the waker will not be called, we have to poll manually.
@@ -248,7 +246,7 @@ async fn reset_twice() { | |||
|
|||
sleep(ms(20)).await; | |||
|
|||
assert!(queue.is_woken()); | |||
assert_ready_some!(poll!(queue)); |
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.
Note
queue.reset_at
resets inner Sleep
, however, the new implementation will drop the inner timer and create a new one. So the waker will not be called, we have to poll manually.
// runtime is shutting down | ||
// OR waking up expired timers | ||
|
||
// Track that a task was scheduled from **outside** of the runtime. | ||
self.shared.scheduler_metrics.inc_remote_schedule_count(); | ||
|
||
// Schedule the task | ||
self.shared.inject.push(task); | ||
self.driver.unpark(); |
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.
Note
Since the wheel is stored in the Core
, the cx.core
is None
while waking up timers.
While we could store Option in Core, this would double the number of possible states in the local time subsystem, which isn't worth it.
695eea8
to
e9255ee
Compare
@@ -41,7 +39,6 @@ mod wake_list; | |||
feature = "fs", | |||
feature = "rt", | |||
feature = "signal", | |||
feature = "time", | |||
))] | |||
pub(crate) use wake_list::WakeList; |
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.
Note
We no long use WakeList
in the time subsystem.
4138c14
to
a85b267
Compare
Signed-off-by: ADD-SP <[email protected]>
Signed-off-by: ADD-SP <[email protected]>
Signed-off-by: ADD-SP <[email protected]>
Signed-off-by: ADD-SP <[email protected]>
Signed-off-by: ADD-SP <[email protected]>
Signed-off-by: ADD-SP <[email protected]>
Signed-off-by: ADD-SP <[email protected]>
Signed-off-by: ADD-SP <[email protected]>
Signed-off-by: ADD-SP <[email protected]>
Signed-off-by: ADD-SP <[email protected]>
Signed-off-by: ADD-SP <[email protected]>
Signed-off-by: ADD-SP <[email protected]>
Signed-off-by: ADD-SP <[email protected]>
Signed-off-by: ADD-SP <[email protected]>
Signed-off-by: ADD-SP <[email protected]>
Signed-off-by: ADD-SP <[email protected]>
5e59ce4
to
86a1e15
Compare
Signed-off-by: ADD-SP <[email protected]>
86a1e15
to
b7692de
Compare
Review guide
Rationale for some technical decisions
Please checkout the inline PR comments I wrote.
Benchmarks
Script: https://gist.github.com/ADD-SP/5c9596972898e273f0824c73fe992f4d