concurrent-futures: poll before pushing into FuturesUnordered (this will do io_uring submission in most cases)

This commit is contained in:
Christian Schwarz
2024-12-12 19:37:23 +01:00
parent 1f7f947119
commit 87755bf80e

View File

@@ -23,6 +23,7 @@ use std::future::Future;
use std::ops::Range;
use std::pin::Pin;
use std::sync::Arc;
use std::task::Poll;
use std::time::{Duration, SystemTime, UNIX_EPOCH};
use utils::lsn::Lsn;
@@ -182,7 +183,13 @@ impl IoConcurrency {
tokio::spawn(fut);
}
IoConcurrency::FuturesUnordered { futures } => {
futures.push(Box::pin(fut));
let mut fut = Box::pin(fut);
match futures::poll!(&mut fut) {
Poll::Ready(()) => {}
Poll::Pending => {
futures.push(fut);
}
}
}
}
}