From 6c383ca0777144358483d87d8dd10805bdb86baf Mon Sep 17 00:00:00 2001 From: Jed <4679729+jedleggett@users.noreply.github.com> Date: Wed, 28 Aug 2024 13:03:40 -0500 Subject: [PATCH] make cli arg --- relayer/src/relayer.rs | 5 ++++- transaction-relayer/src/main.rs | 5 +++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/relayer/src/relayer.rs b/relayer/src/relayer.rs index 5ac51ae..a5f7b9d 100644 --- a/relayer/src/relayer.rs +++ b/relayer/src/relayer.rs @@ -425,6 +425,7 @@ impl RelayerImpl { validator_packet_batch_size: usize, forward_all: bool, slot_lookahead: u64, + heartbeat_tick_time: u64, ) -> Self { // receiver tracked as relayer_metrics.subscription_receiver_len let (subscription_sender, subscription_receiver) = @@ -451,6 +452,7 @@ impl RelayerImpl { address_lookup_table_cache, validator_packet_batch_size, forward_all, + heartbeat_tick_time, ); warn!("RelayerImpl thread exited with result {res:?}") }) @@ -487,10 +489,11 @@ impl RelayerImpl { address_lookup_table_cache: Arc>, validator_packet_batch_size: usize, forward_all: bool, + heartbeat_tick_time: u64, ) -> RelayerResult<()> { let mut highest_slot = Slot::default(); - let heartbeat_tick = crossbeam_channel::tick(Duration::from_millis(100)); + let heartbeat_tick = crossbeam_channel::tick(Duration::from_millis(heartbeat_tick_time)); let metrics_tick = crossbeam_channel::tick(Duration::from_millis(1000)); let mut relayer_metrics = RelayerMetrics::new( diff --git a/transaction-relayer/src/main.rs b/transaction-relayer/src/main.rs index 33412e5..28f5aa5 100644 --- a/transaction-relayer/src/main.rs +++ b/transaction-relayer/src/main.rs @@ -240,6 +240,10 @@ struct Args { /// The slot lookahead to use when forwarding transactions #[arg(long, env, default_value_t = 5)] slot_lookahead: u64, + + /// Time in milliseconds between heartbeat ticks + #[arg(long, env default_value_t = 100)] + heartbeat_tick_time: u64, } #[derive(Debug)] @@ -536,6 +540,7 @@ fn main() { args.validator_packet_batch_size, args.forward_all, args.slot_lookahead, + args.heartbeat_tick_time, ); let priv_key = fs::read(&args.signing_key_pem_path).unwrap_or_else(|_| {