Skip to content

Commit 5f554d7

Browse files
committed
Add timeout for exporter
1 parent 82108e4 commit 5f554d7

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

config/config.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,9 @@ key_store.root_path = "/path/to/keystore"
8989
# Age after which a price update is considered stale and not published
9090
# exporter.staleness_threshold = "5s"
9191

92+
# RPC timeout for the requests to the RPC for sending price updates and monitoring them
93+
# exporter.rpc_timeout = "10s"
94+
9295
# Maximum size of a batch
9396
# exporter.max_batch_size = 12
9497

src/agent/solana/exporter.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,9 @@ pub struct Config {
9797
/// Age after which a price update is considered stale and not published
9898
#[serde(with = "humantime_serde")]
9999
pub staleness_threshold: Duration,
100+
/// RPC timeout for the requests to the RPC for sending price updates and monitoring them
101+
#[serde(with = "humantime_serde")]
102+
pub rpc_timeout: Duration,
100103
/// Maximum size of a batch
101104
pub max_batch_size: usize,
102105
/// Capacity of the channel between the Exporter and the Transaction Monitor
@@ -117,6 +120,7 @@ impl Default for Config {
117120
refresh_network_state_interval_duration: Duration::from_millis(200),
118121
publish_interval_duration: Duration::from_secs(1),
119122
staleness_threshold: Duration::from_secs(5),
123+
rpc_timeout: Duration::from_secs(10),
120124
max_batch_size: 12,
121125
inflight_transactions_channel_capacity: 10000,
122126
transaction_monitor: Default::default(),
@@ -214,7 +218,7 @@ impl Exporter {
214218
) -> Self {
215219
let publish_interval = time::interval(config.publish_interval_duration);
216220
Exporter {
217-
rpc_client: RpcClient::new(rpc_url.to_string()),
221+
rpc_client: RpcClient::new_with_timeout(rpc_url.to_string(), config.rpc_timeout),
218222
config,
219223
publish_interval,
220224
key_store,

0 commit comments

Comments
 (0)