Skip to content

Commit

Permalink
[cli] partially fix benchmarks
Browse files Browse the repository at this point in the history
  • Loading branch information
clangenb committed Oct 27, 2024
1 parent b519521 commit 9f99f24
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions cli/src/benchmark/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ use sp_keystore::Keystore;
use std::{
boxed::Box,
string::ToString,
sync::mpsc::{channel, Receiver},
sync::mpsc::{channel, Receiver, Sender},
thread, time,
time::Instant,
vec::Vec,
Expand Down Expand Up @@ -92,6 +92,7 @@ struct BenchmarkClient {
account: sr25519_core::Pair,
current_balance: u128,
client_api: DirectClient,
sender: Sender<String>,
receiver: Receiver<String>,
}

Expand All @@ -107,8 +108,8 @@ impl BenchmarkClient {

debug!("setup sender and receiver");
let (sender, receiver) = channel();
client_api.watch(initial_request, sender);
BenchmarkClient { account, current_balance: initial_balance, client_api, receiver }
client_api.watch(initial_request, sender.clone());
BenchmarkClient { account, current_balance: initial_balance, client_api, sender, receiver }
}
}

Expand Down Expand Up @@ -164,7 +165,7 @@ impl BenchmarkCommand {
&mrenclave,
&shard,
)
.into_trusted_operation(trusted_args.direct);
.into_trusted_operation(true);

// For the last account we wait for confirmation in order to ensure all accounts were setup correctly
let wait_for_confirmation = i == self.number_clients - 1;
Expand Down Expand Up @@ -221,7 +222,8 @@ impl BenchmarkCommand {

let last_iteration = i == self.number_iterations - 1;
let jsonrpc_call = get_json_request(shard, &top, shielding_pubkey);
client.client_api.send(&jsonrpc_call).unwrap();

client.client_api.watch(jsonrpc_call, client.sender.clone());
let result = wait_for_top_confirmation(
self.wait_for_confirmation || last_iteration,
&client,
Expand Down

0 comments on commit 9f99f24

Please sign in to comment.