stream: handle overflowing timer durations (#8354)

This commit is contained in:
Minh Vu
2026-09-07 18:17:16 +02:00
committed by GitHub
parent 6b3c90cc58
commit 483e4b9ee7
4 changed files with 22 additions and 9 deletions
+8
View File
@@ -107,3 +107,11 @@ async fn no_timeouts() {
assert_ready_eq!(stream.poll_next(), Some(Ok(5)));
assert_ready_eq!(stream.poll_next(), None);
}
#[tokio::test]
async fn duration_max_does_not_overflow() {
let stream = stream::iter([1]).timeout(Duration::MAX);
let mut stream = task::spawn(stream);
assert_ready_eq!(stream.poll_next(), Some(Ok(1)));
}
+7
View File
@@ -26,3 +26,10 @@ async fn usage() {
assert_ready!(stream.poll_next());
}
#[tokio::test]
async fn duration_max_does_not_overflow() {
let mut stream = task::spawn(futures::stream::iter([1]).throttle(Duration::MAX));
assert_ready_eq!(stream.poll_next(), Some(1));
}