From 0b01884fca14a7b9a460c69a87cb550acb345dea Mon Sep 17 00:00:00 2001 From: Nikolay Kim Date: Thu, 12 Apr 2018 13:08:13 -0700 Subject: [PATCH] add timeouts stats to client connector --- src/client/connector.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/client/connector.rs b/src/client/connector.rs index 4993f17f8..0b6e63bdb 100644 --- a/src/client/connector.rs +++ b/src/client/connector.rs @@ -40,6 +40,7 @@ pub struct ClientConnectorStats { pub opened: usize, pub closed: usize, pub errors: usize, + pub timeouts: usize, } #[derive(Debug)] @@ -307,8 +308,8 @@ impl ClientConnector { subscriber: None, pool: Rc::new(Pool::new(Rc::clone(&modified))), pool_modified: modified, - conn_lifetime: Duration::from_secs(15), - conn_keep_alive: Duration::from_secs(75), + conn_lifetime: Duration::from_secs(75), + conn_keep_alive: Duration::from_secs(15), limit: 100, limit_per_host: 0, acquired: 0, @@ -530,6 +531,7 @@ impl ClientConnector { let mut idx = 0; while idx < waiters.len() { if waiters[idx].wait <= now { + self.stats.timeouts += 1; let waiter = waiters.swap_remove_back(idx).unwrap(); let _ = waiter.tx.send(Err(ClientConnectorError::Timeout)); } else {