Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

35 changes: 33 additions & 2 deletions forester/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,39 @@ pub struct StartArgs {
#[arg(long, env = "FORESTER_ENABLE_PRIORITY_FEES", default_value = "false")]
pub enable_priority_fees: bool,

#[arg(long, env = "FORESTER_RPC_POOL_SIZE", default_value = "98")]
pub rpc_pool_size: usize,
#[arg(long, env = "FORESTER_RPC_POOL_SIZE", default_value = "50")]
pub rpc_pool_size: u32,

#[arg(
long,
env = "FORESTER_RPC_POOL_CONNECTION_TIMEOUT_SECS",
default_value = "15"
)]
pub rpc_pool_connection_timeout_secs: u64,

#[arg(
long,
env = "FORESTER_RPC_POOL_IDLE_TIMEOUT_SECS",
default_value = "300"
)]
pub rpc_pool_idle_timeout_secs: u64,

#[arg(long, env = "FORESTER_RPC_POOL_MAX_RETRIES", default_value = "100")]
pub rpc_pool_max_retries: u32,

#[arg(
long,
env = "FORESTER_RPC_POOL_INITIAL_RETRY_DELAY_MS",
default_value = "1000"
)]
pub rpc_pool_initial_retry_delay_ms: u64,

#[arg(
long,
env = "FORESTER_RPC_POOL_MAX_RETRY_DELAY_MS",
default_value = "16000"
)]
pub rpc_pool_max_retry_delay_ms: u64,

#[arg(
long,
Expand Down
31 changes: 28 additions & 3 deletions forester/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ pub struct ForesterConfig {
pub indexer_config: IndexerConfig,
pub transaction_config: TransactionConfig,
pub general_config: GeneralConfig,
pub rpc_pool_config: RpcPoolConfig,
pub registry_pubkey: Pubkey,
pub payer_keypair: Keypair,
pub derivation_pubkey: Pubkey,
Expand Down Expand Up @@ -67,12 +68,21 @@ pub struct TransactionConfig {

#[derive(Debug, Clone)]
pub struct GeneralConfig {
pub rpc_pool_size: usize,
pub slot_update_interval_seconds: u64,
pub tree_discovery_interval_seconds: u64,
pub enable_metrics: bool,
}

#[derive(Debug, Clone, Copy)]
pub struct RpcPoolConfig {
pub max_size: u32,
pub connection_timeout_secs: u64,
pub idle_timeout_secs: u64,
pub max_retries: u32,
pub initial_retry_delay_ms: u64,
pub max_retry_delay_ms: u64,
}

impl Default for QueueConfig {
fn default() -> Self {
QueueConfig {
Expand Down Expand Up @@ -182,11 +192,18 @@ impl ForesterConfig {
enable_priority_fees: args.enable_priority_fees,
},
general_config: GeneralConfig {
rpc_pool_size: args.rpc_pool_size,
slot_update_interval_seconds: args.slot_update_interval_seconds,
tree_discovery_interval_seconds: args.tree_discovery_interval_seconds,
enable_metrics: args.enable_metrics(),
},
rpc_pool_config: RpcPoolConfig {
max_size: args.rpc_pool_size,
connection_timeout_secs: args.rpc_pool_connection_timeout_secs,
idle_timeout_secs: args.rpc_pool_idle_timeout_secs,
max_retries: args.rpc_pool_max_retries,
initial_retry_delay_ms: args.rpc_pool_initial_retry_delay_ms,
max_retry_delay_ms: args.rpc_pool_max_retry_delay_ms,
},
registry_pubkey: Pubkey::from_str(&registry_pubkey).map_err(|e| {
ConfigError::InvalidPubkey {
field: "registry_pubkey",
Expand Down Expand Up @@ -221,11 +238,18 @@ impl ForesterConfig {
indexer_config: IndexerConfig::default(),
transaction_config: TransactionConfig::default(),
general_config: GeneralConfig {
rpc_pool_size: 10,
slot_update_interval_seconds: 10,
tree_discovery_interval_seconds: 60,
enable_metrics: args.enable_metrics(),
},
rpc_pool_config: RpcPoolConfig {
max_size: 10,
connection_timeout_secs: 15,
idle_timeout_secs: 300,
max_retries: 10,
initial_retry_delay_ms: 1000,
max_retry_delay_ms: 16000,
},
registry_pubkey: Pubkey::default(),
payer_keypair: Keypair::new(),
derivation_pubkey: Pubkey::default(),
Expand All @@ -243,6 +267,7 @@ impl Clone for ForesterConfig {
indexer_config: self.indexer_config.clone(),
transaction_config: self.transaction_config.clone(),
general_config: self.general_config.clone(),
rpc_pool_config: self.rpc_pool_config,
registry_pubkey: self.registry_pubkey,
payer_keypair: self.payer_keypair.insecure_clone(),
derivation_pubkey: self.derivation_pubkey,
Expand Down
Loading
Loading