From cc2eb0e25a7c8e14043d4cd612571f12fa9ddd1c Mon Sep 17 00:00:00 2001 From: Bastian Gruber Date: Mon, 15 Apr 2024 15:08:54 -0300 Subject: [PATCH] fix: increase channel size, increase interval --- crates/topos-config/src/tce/synchronization.rs | 2 +- crates/topos-tce-synchronizer/src/builder.rs | 2 +- crates/topos-tce/src/app_context.rs | 1 + crates/topos-tce/src/lib.rs | 1 - 4 files changed, 3 insertions(+), 3 deletions(-) diff --git a/crates/topos-config/src/tce/synchronization.rs b/crates/topos-config/src/tce/synchronization.rs index 222cd1030..e893be748 100644 --- a/crates/topos-config/src/tce/synchronization.rs +++ b/crates/topos-config/src/tce/synchronization.rs @@ -23,7 +23,7 @@ impl Default for SynchronizationConfig { } impl SynchronizationConfig { - pub const INTERVAL_SECONDS: u64 = 10; + pub const INTERVAL_SECONDS: u64 = 2; pub const LIMIT_PER_SUBNET: usize = 100; const fn default_interval_seconds() -> u64 { diff --git a/crates/topos-tce-synchronizer/src/builder.rs b/crates/topos-tce-synchronizer/src/builder.rs index a7b70e08a..4733664e3 100644 --- a/crates/topos-tce-synchronizer/src/builder.rs +++ b/crates/topos-tce-synchronizer/src/builder.rs @@ -29,7 +29,7 @@ impl Default for SynchronizerBuilder { network_client: None, store: None, config: SynchronizationConfig::default(), - event_channel_size: 100, + event_channel_size: 10_000, shutdown: None, } } diff --git a/crates/topos-tce/src/app_context.rs b/crates/topos-tce/src/app_context.rs index fedc50b66..cc597ff7e 100644 --- a/crates/topos-tce/src/app_context.rs +++ b/crates/topos-tce/src/app_context.rs @@ -100,6 +100,7 @@ impl AppContext { ) { loop { tokio::select! { + biased; Some(delivery) = broadcast_stream.next() => { let certificate_id = delivery.0.certificate.id; diff --git a/crates/topos-tce/src/lib.rs b/crates/topos-tce/src/lib.rs index 42f654dc7..e4f3bc894 100644 --- a/crates/topos-tce/src/lib.rs +++ b/crates/topos-tce/src/lib.rs @@ -152,7 +152,6 @@ pub async fn run( debug!("P2P layer bootstrapped"); debug!("Creating the Synchronizer"); - let (synchronizer_runtime, synchronizer_stream) = topos_tce_synchronizer::Synchronizer::builder() .with_config(config.synchronization.clone())