refactor(client): only spawn pooled in executor if not ready when response recieved

This commit is contained in:
Sean McArthur
2018-03-13 18:46:52 -07:00
parent 26ec18a282
commit 91b9700862
3 changed files with 130 additions and 105 deletions

View File

@@ -1,10 +1,8 @@
extern crate pretty_env_logger;
use std::time::Duration;
use futures::Async;
use futures::future::poll_fn;
use tokio::reactor::{Core, Timeout};
use tokio::reactor::Core;
use mock::MockConnector;
use super::*;
@@ -70,11 +68,6 @@ fn conn_reset_after_write() {
Ok(Async::Ready(()))
});
core.run(res1.join(srv1)).expect("res1");
// run a tiny timeout just to spin the core, so that the pool
// can tell the socket is ready again
let timeout = Timeout::new(Duration::from_millis(50), &core.handle()).unwrap();
core.run(timeout).unwrap();
}
let res2 = client.get("http://mock.local/a".parse().unwrap());