Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enable/disable for follow-blocks in perftest #95

Merged
merged 1 commit into from
Nov 27, 2024
Merged
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
5 changes: 3 additions & 2 deletions config/perftest-sample.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ rpc_addrs = [
"http://127.0.0.12:3384",
"http://127.0.0.13:3385"
]
interval = "1000ms"
interval = "100ms"

[follow_blocks]
rpc_addr = "http://127.0.0.11:3383"
rpc_addr = "http://127.0.0.11:3383"
enable = false
8 changes: 7 additions & 1 deletion src/bin/perftest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ pub struct SubmitMessageConfig {
#[derive(Debug, Clone, Deserialize, Serialize)]
pub struct FollowBlocksConfig {
pub rpc_addr: String,
pub enable: bool,
}

#[derive(Debug, Clone, Deserialize, Serialize)]
Expand Down Expand Up @@ -126,6 +127,9 @@ async fn main() -> Result<(), Box<dyn Error>> {
let submit_message_handles = start_submit_messages(messages_tx, cfg.clone());

let follow_blocks_handle = tokio::spawn(async move {
if !cfg.follow_blocks.enable {
return;
}
let addr = cfg.follow_blocks.rpc_addr.clone();
follow_blocks(addr, blocks_tx).await.unwrap()
});
Expand Down Expand Up @@ -177,7 +181,9 @@ async fn main() -> Result<(), Box<dyn Error>> {
time_to_confirmation.clear();
block_times.clear();
iteration += 1;
if iteration > cfg.num_iterations {

// 0 iterations means go forever
if cfg.num_iterations > 0 && iteration > cfg.num_iterations {
for submit_message_handle in submit_message_handles {
submit_message_handle.abort();
}
Expand Down