mirror of
https://github.com/actix/actix-extras.git
synced 2025-01-23 23:34:35 +01:00
add timeouts stats to client connector
This commit is contained in:
parent
83168731fc
commit
0b01884fca
@ -40,6 +40,7 @@ pub struct ClientConnectorStats {
|
|||||||
pub opened: usize,
|
pub opened: usize,
|
||||||
pub closed: usize,
|
pub closed: usize,
|
||||||
pub errors: usize,
|
pub errors: usize,
|
||||||
|
pub timeouts: usize,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
@ -307,8 +308,8 @@ impl ClientConnector {
|
|||||||
subscriber: None,
|
subscriber: None,
|
||||||
pool: Rc::new(Pool::new(Rc::clone(&modified))),
|
pool: Rc::new(Pool::new(Rc::clone(&modified))),
|
||||||
pool_modified: modified,
|
pool_modified: modified,
|
||||||
conn_lifetime: Duration::from_secs(15),
|
conn_lifetime: Duration::from_secs(75),
|
||||||
conn_keep_alive: Duration::from_secs(75),
|
conn_keep_alive: Duration::from_secs(15),
|
||||||
limit: 100,
|
limit: 100,
|
||||||
limit_per_host: 0,
|
limit_per_host: 0,
|
||||||
acquired: 0,
|
acquired: 0,
|
||||||
@ -530,6 +531,7 @@ impl ClientConnector {
|
|||||||
let mut idx = 0;
|
let mut idx = 0;
|
||||||
while idx < waiters.len() {
|
while idx < waiters.len() {
|
||||||
if waiters[idx].wait <= now {
|
if waiters[idx].wait <= now {
|
||||||
|
self.stats.timeouts += 1;
|
||||||
let waiter = waiters.swap_remove_back(idx).unwrap();
|
let waiter = waiters.swap_remove_back(idx).unwrap();
|
||||||
let _ = waiter.tx.send(Err(ClientConnectorError::Timeout));
|
let _ = waiter.tx.send(Err(ClientConnectorError::Timeout));
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user