Skip to content

Commit

Permalink
concurrent-futures: poll before pushing into FuturesUnordered (this w…
Browse files Browse the repository at this point in the history
…ill do io_uring submission in most cases)
  • Loading branch information
problame committed Dec 12, 2024
1 parent 1f7f947 commit 87755bf
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion pageserver/src/tenant/storage_layer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}
}
}
}
}
Expand Down

0 comments on commit 87755bf

Please sign in to comment.