Merge pull request #160 from blockworks-foundation/do_not_destroy_the_connection_with_exisiting_tpus
Avoiding destroying connections with existing leaders
This commit is contained in:
commit
807f84c1cf
|
@ -104,7 +104,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,20 +146,12 @@ 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();
|
||||
}
|
||||
}
|
||||
|
||||
let task_counter = task_counter.clone();
|
||||
let connection_pool = connection_pool.clone();
|
||||
|
|
Loading…
Reference in New Issue