Skip to content

Commit d61f75d

Browse files
authored
Error out if chain listener fails to start in benchmark client (#4449)
## Motivation Currently if the chain listener fails to start, we just continue with the benchmarks. However, if we want to ensure they're more "realistic", we should enforce that the chain listener is properly running. ## Proposal Error out if the chain listener fails to start ## Test Plan Benchmark a network using this. ## Release Plan - Nothing to do / These changes follow the usual release cycle.
1 parent f47d3e8 commit d61f75d

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

linera-client/src/benchmark.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,8 @@ pub enum BenchmarkError {
7575
NotEnoughChainsInWallet(usize, usize),
7676
#[error("Random number generator error: {0}")]
7777
RandError(#[from] rand::Error),
78+
#[error("Chain listener startup error")]
79+
ChainListenerStartupError,
7880
}
7981

8082
#[derive(Debug)]
@@ -130,10 +132,11 @@ impl<Env: Environment> Benchmark<Env> {
130132
let notifier = Arc::new(Notify::new());
131133
let barrier = Arc::new(Barrier::new(num_chains + 1));
132134

133-
let chain_listener_result = chain_listener.run().await;
134-
135-
let chain_listener_handle =
136-
tokio::spawn(async move { chain_listener_result?.await }.in_current_span());
135+
let chain_listener_future = chain_listener
136+
.run()
137+
.await
138+
.map_err(|_| BenchmarkError::ChainListenerStartupError)?;
139+
let chain_listener_handle = tokio::spawn(chain_listener_future.in_current_span());
137140

138141
let bps_control_task = Self::bps_control_task(
139142
&barrier,

0 commit comments

Comments
 (0)