-
Notifications
You must be signed in to change notification settings - Fork 57
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
refactor Clock::stream_slots
to use IntervalStream
#215
Comments
fixing this one, github mev bot look away |
I'm hitting a roadblock here because Here's my current Impl: pub fn stream_slots(&self) -> impl Stream<Item = Slot> + '_ {
async_stream::stream! {
let slot = self.current_slot().expect("after genesis");
yield slot;
let mut interval_tick = tokio::time::interval(self.duration_until_slot(slot + 1));
interval_tick.tick().await;
}
} |
My bad, I forgot to add the loop: pub fn stream_slots(&self) -> impl Stream<Item = Slot> + '_ {
async_stream::stream! {
let mut slot = self.current_slot().expect("after genesis");
let mut interval_tick = tokio::time::interval(self.duration_until_slot(slot + 1));
loop{
yield slot;
interval_tick.tick().await;
slot = self.current_slot().expect("after genesis");
}
}
} but now when I run the running 1 test
test clock::tests::test_slot_stream has been running for over 60 seconds |
can you open a PR w/ the changes? |
the idea behind this issue was to just use also, the interval will just be you can collect the first |
Just open a PR w/ the changes And I couldn't figure out a way to do this :(
|
we can likely use something like this to simplify the clock internals:
https://docs.rs/tokio-stream/latest/tokio_stream/wrappers/struct.IntervalStream.html
The text was updated successfully, but these errors were encountered: