Skip to content

Commit

Permalink
feat(stress_test_sync_client): add blocks-per-request option
Browse files Browse the repository at this point in the history
  • Loading branch information
CHr15F0x committed Feb 19, 2025
1 parent 58c37a1 commit c1411fb
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions crates/p2p/examples/stress_test_sync_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ use p2p_proto::transaction::TransactionsRequest;
use pathfinder_common::ChainId;

const USAGE: &str = "Usage: stress_test_sync_client <server-multiaddr-with-peer-id> \
<max-concurrent-request-streams> <num-requests> <initial-delay-ms>";
<max-concurrent-request-streams> <num-requests> <blocks-per-request> \
<initial-delay-ms>";

#[tokio::main]
async fn main() -> anyhow::Result<()> {
Expand All @@ -34,16 +35,21 @@ async fn main() -> anyhow::Result<()> {
.context(USAGE)?;
let max_concurrent_streams = args()
.nth(2)
.unwrap_or("1000".to_string())
.unwrap_or("100".to_string())
.parse::<usize>()
.context(USAGE)?;
let num_requests = args()
.nth(3)
.unwrap_or("1000".to_string())
.unwrap_or("100".to_string())
.parse::<u64>()
.context(USAGE)?;
let initial_delay_ms = args()
let blocks_per_request = args()
.nth(4)
.unwrap_or("100".to_string())
.parse::<u64>()
.context(USAGE)?;
let initial_delay_ms = args()
.nth(5)
.unwrap_or("0".to_string())
.parse::<u64>()
.context(USAGE)?;
Expand Down Expand Up @@ -93,10 +99,10 @@ async fn main() -> anyhow::Result<()> {
server_peer_id,
TransactionsRequest {
iteration: Iteration {
start: BlockNumberOrHash::Number(start * 1000),
start: BlockNumberOrHash::Number(start * blocks_per_request),
direction: Direction::Forward,
// Max allowed by pathfinder (as a server)
limit: 1000,
limit: blocks_per_request,
step: 1.into(),
},
},
Expand Down

0 comments on commit c1411fb

Please sign in to comment.