When making requests in quick succession in combination with futures::executor::block_on, it can happen that they never return and infinitely block.
Example code:
#[tokio::main]
async fn main() {
let web3 = web3::Web3::new(web3::transports::Http::new("http://localhost:8545").unwrap());
loop {
// Get the block number
println!("requesting");
futures::executor::block_on(futures::future::join_all(vec![web3.eth().block_number()]));
println!("done");
// Sleep for 10 ms
thread::sleep(time::Duration::from_millis(10));
}
}
For me, after a short period of time the last requesting is printed and the output never continues. When I replace the futures::executor::block_on with .await, this never seems to happen.
When making requests in quick succession in combination with
futures::executor::block_on
, it can happen that they never return and infinitely block.Example code:
For me, after a short period of time the last
requesting
is printed and the output never continues. When I replace thefutures::executor::block_on
with.await
, this never seems to happen.