fix mac test

This commit is contained in:
fakeshadow 2021-03-29 21:49:40 +08:00
parent bee0a31add
commit 467ecbf75a
1 changed files with 19 additions and 7 deletions

View File

@ -1450,13 +1450,25 @@ mod tests {
stream.shutdown().await.unwrap(); stream.shutdown().await.unwrap();
actix_rt::time::sleep(Duration::from_secs(3)).await; let start = Instant::now();
actix_rt::task::yield_now().await; let mut interval = actix_rt::time::interval(Duration::from_secs(1));
poll_fn(|cx| { loop {
assert!(h1.as_mut().poll(cx).is_ready()); let _ = interval.tick().await;
Poll::Ready(())
}) if start.elapsed() > Duration::from_secs(10) {
.await; panic!("Payload interval pending check failed to shutdown dispatcher");
}
let ready = poll_fn(|cx| {
let ready = h1.as_mut().poll(cx).is_ready();
Poll::Ready(ready)
})
.await;
if ready {
return;
}
}
} }
} }