Use Skip as the MissedTickBehavior for tokio futures backend
This commit is contained in:
parent
105b8bd5ad
commit
e8ec6b94b6
1 changed files with 8 additions and 6 deletions
|
|
@ -55,13 +55,15 @@ pub mod time {
|
|||
|
||||
let start = tokio::time::Instant::now() + self.0;
|
||||
|
||||
let mut interval = tokio::time::interval_at(start, self.0);
|
||||
interval.set_missed_tick_behavior(
|
||||
tokio::time::MissedTickBehavior::Skip,
|
||||
);
|
||||
|
||||
let stream = {
|
||||
futures::stream::unfold(
|
||||
tokio::time::interval_at(start, self.0),
|
||||
|mut interval| async move {
|
||||
Some((interval.tick().await, interval))
|
||||
},
|
||||
)
|
||||
futures::stream::unfold(interval, |mut interval| async move {
|
||||
Some((interval.tick().await, interval))
|
||||
})
|
||||
};
|
||||
|
||||
stream.map(tokio::time::Instant::into_std).boxed()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue