Avoiding destroying connections with existing leaders
This commit is contained in:
parent
5ec8ba4aee
commit
48d26eac15
|
@ -101,7 +101,7 @@ impl LiteBridge {
|
|||
max_number_of_connections: 10,
|
||||
unistream_timeout: Duration::from_millis(500),
|
||||
write_timeout: Duration::from_secs(1),
|
||||
number_of_transactions_per_unistream: 10,
|
||||
number_of_transactions_per_unistream: 8,
|
||||
},
|
||||
};
|
||||
|
||||
|
|
|
@ -146,19 +146,11 @@ impl ActiveConnection {
|
|||
}
|
||||
}
|
||||
|
||||
if txs.len() >= number_of_transactions_per_unistream - 1 {
|
||||
// queue getting full and a connection poll is getting slower
|
||||
// add more connections to the pool
|
||||
if connection_pool.len() < max_number_of_connections {
|
||||
connection_pool.add_connection().await;
|
||||
NB_QUIC_CONNECTIONS.inc();
|
||||
}
|
||||
} else if txs.len() == 1 {
|
||||
// low traffic / reduce connection till minimum 1
|
||||
if connection_pool.len() > 1 {
|
||||
connection_pool.remove_connection().await;
|
||||
NB_QUIC_CONNECTIONS.dec();
|
||||
}
|
||||
// queue getting full and a connection poll is getting slower
|
||||
// add more connections to the pool
|
||||
if connection_pool.len() < max_number_of_connections {
|
||||
connection_pool.add_connection().await;
|
||||
NB_QUIC_CONNECTIONS.inc();
|
||||
}
|
||||
|
||||
let task_counter = task_counter.clone();
|
||||
|
|
Loading…
Reference in New Issue