diff --git a/stream-composition/src/main.rs b/stream-composition/src/main.rs index 6b26149..cc3c3aa 100644 --- a/stream-composition/src/main.rs +++ b/stream-composition/src/main.rs @@ -5,9 +5,10 @@ fn main() { trpl::run(async { let messages = get_messages().timeout(Duration::from_millis(200)); let intervals = get_intervals() - .map(|count| format!("Interval: {count}")) + .map(|count| format!("Interval #{count}")) + .throttle(Duration::from_millis(100)) .timeout(Duration::from_secs(10)); - let merged = messages.merge(intervals); + let merged = messages.merge(intervals).take(20); let mut stream = pin!(merged); while let Some(result) = stream.next().await {