use std::time::Duration;
pub(super) async fn drain_spawned() {
for _ in 0..16 {
tokio::task::yield_now().await;
}
}
pub(super) async fn wait_until(mut pred: impl FnMut() -> bool) -> bool {
let deadline = std::time::Instant::now() + Duration::from_secs(3);
while std::time::Instant::now() < deadline {
if pred() {
return true;
}
tokio::time::sleep(Duration::from_millis(10)).await;
}
false
}