From 48d26eac15b87f792bccf98570df19717f3669d1 Mon Sep 17 00:00:00 2001 From: Godmode Galactus Date: Wed, 19 Jul 2023 11:08:27 +0200 Subject: [PATCH] Avoiding destroying connections with existing leaders --- lite-rpc/src/bridge.rs | 2 +- .../src/tpu_utils/tpu_connection_manager.rs | 18 +++++------------- 2 files changed, 6 insertions(+), 14 deletions(-) diff --git a/lite-rpc/src/bridge.rs b/lite-rpc/src/bridge.rs index 436e5a9b..32d0e86d 100644 --- a/lite-rpc/src/bridge.rs +++ b/lite-rpc/src/bridge.rs @@ -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, }, }; diff --git a/services/src/tpu_utils/tpu_connection_manager.rs b/services/src/tpu_utils/tpu_connection_manager.rs index 2a3f04cd..68a9b5f5 100644 --- a/services/src/tpu_utils/tpu_connection_manager.rs +++ b/services/src/tpu_utils/tpu_connection_manager.rs @@ -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();