summaryrefslogtreecommitdiffstats
path: root/futures/src
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón <hector@hecrj.dev>2024-04-17 12:43:25 +0200
committerLibravatar GitHub <noreply@github.com>2024-04-17 12:43:25 +0200
commitd8ce7bc8d404cc2274177d02180518937b6eb29a (patch)
tree293ec9c82eedc982b5c166ae0295494a8010ad47 /futures/src
parent105b8bd5ad6ade1f203a0d8b0b93bd06f61f621a (diff)
parentb6b51375cfd96e330d6ee22096dacf831a992aa7 (diff)
downloadiced-d8ce7bc8d404cc2274177d02180518937b6eb29a.tar.gz
iced-d8ce7bc8d404cc2274177d02180518937b6eb29a.tar.bz2
iced-d8ce7bc8d404cc2274177d02180518937b6eb29a.zip
Merge pull request #2389 from iced-rs/fix/async-memory-usage
Implement backpressure mechanism for `iced_winit::Proxy`
Diffstat (limited to 'futures/src')
-rw-r--r--futures/src/backend/native/tokio.rs14
1 files changed, 8 insertions, 6 deletions
diff --git a/futures/src/backend/native/tokio.rs b/futures/src/backend/native/tokio.rs
index 3ab7f675..df91d798 100644
--- a/futures/src/backend/native/tokio.rs
+++ b/futures/src/backend/native/tokio.rs
@@ -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()