-
Notifications
You must be signed in to change notification settings - Fork 410
Rewrite sync bg processor #3820
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: main
Are you sure you want to change the base?
Rewrite sync bg processor #3820
Conversation
👋 I see @TheBlueMatt was un-assigned. |
@@ -340,6 +344,47 @@ impl Sleeper { | |||
} | |||
} | |||
|
|||
pub struct Sleep { |
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.
There is already Sleeper
in the repository, but from_single_future
takes a future and isn't just a sleep.
No need to make it complicated using async tasks?
27a8ad2
to
74f5af1
Compare
} | ||
}, | ||
|_| Instant::now(), | ||
|time: &Instant, dur| time.elapsed().as_secs() > dur, |
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 there a reason why this wasn't done in the first place? All the timer checks seem to be non-blocking.
let waker_clone = waker.clone(); | ||
|
||
thread::spawn(move || { | ||
thread::sleep(duration); |
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.
Chatgpt implementation - probably a lot wrong about it.
@TheBlueMatt is this a viable approach? |
🔔 1st Reminder Hey @TheBlueMatt! This PR has been waiting for your review. |
Initial attempt to rewrite the sync bg processor so that it uses the async version of it. Prepares for #3778 where the
Persister
trait is made async, and wouldn't be callable from the sync bg processor anymore.Additionally it allows us to get rid of the
define_run_body
macro.Various open ends marked by comments on this PR.