1
0
mirror of https://github.com/fafhrd91/actix-web synced 2025-06-25 22:49:21 +02:00

Fix http client pool and wait queue management

This commit is contained in:
Nikolay Kim
2019-04-23 14:57:03 -07:00
parent 5f6a1a8249
commit d2b0afd859
8 changed files with 430 additions and 52 deletions

View File

@ -124,6 +124,7 @@ impl TestServer {
|e| log::error!("Can not set alpn protocol: {:?}", e),
);
Connector::new()
.conn_lifetime(time::Duration::from_secs(0))
.timeout(time::Duration::from_millis(500))
.ssl(builder.build())
.finish()
@ -131,6 +132,7 @@ impl TestServer {
#[cfg(not(feature = "ssl"))]
{
Connector::new()
.conn_lifetime(time::Duration::from_secs(0))
.timeout(time::Duration::from_millis(500))
.finish()
}
@ -163,6 +165,15 @@ impl TestServerRuntime {
self.rt.block_on(fut)
}
/// Execute future on current core
pub fn block_on_fn<F, R>(&mut self, f: F) -> Result<R::Item, R::Error>
where
F: FnOnce() -> R,
R: Future,
{
self.rt.block_on(lazy(|| f()))
}
/// Execute function on current core
pub fn execute<F, R>(&mut self, fut: F) -> R
where