improve ws_addr arg handling
This commit is contained in:
parent
04580abbe7
commit
819164671b
|
@ -12,18 +12,21 @@ use url::Url;
|
||||||
pub async fn benchnew_confirmation_rate_servicerunner(
|
pub async fn benchnew_confirmation_rate_servicerunner(
|
||||||
bench_config: &BenchConfig,
|
bench_config: &BenchConfig,
|
||||||
rpc_addr: String,
|
rpc_addr: String,
|
||||||
tx_status_websocket_addr: String,
|
tx_status_websocket_addr: Option<String>,
|
||||||
funded_payer: Keypair,
|
funded_payer: Keypair,
|
||||||
) -> confirmation_rate::Metric {
|
) -> confirmation_rate::Metric {
|
||||||
let rpc = Arc::new(RpcClient::new(rpc_addr));
|
let rpc = Arc::new(RpcClient::new(rpc_addr.clone()));
|
||||||
let tx_params = BenchmarkTransactionParams {
|
let tx_params = BenchmarkTransactionParams {
|
||||||
tx_size: bench_config.tx_size,
|
tx_size: bench_config.tx_size,
|
||||||
cu_price_micro_lamports: bench_config.cu_price_micro_lamports,
|
cu_price_micro_lamports: bench_config.cu_price_micro_lamports,
|
||||||
};
|
};
|
||||||
let max_timeout = Duration::from_secs(60);
|
let max_timeout = Duration::from_secs(60);
|
||||||
|
|
||||||
|
let ws_addr = tx_status_websocket_addr.unwrap_or_else(|| rpc_addr.replace("http:", "ws:").replace("https:", "wss:"));
|
||||||
|
|
||||||
let result = send_bulk_txs_and_wait(
|
let result = send_bulk_txs_and_wait(
|
||||||
&rpc,
|
&rpc,
|
||||||
Url::parse(&tx_status_websocket_addr).expect("Invalid URL"),
|
Url::parse(&ws_addr).expect("Invalid WS URL"),
|
||||||
&funded_payer,
|
&funded_payer,
|
||||||
bench_config.tx_count,
|
bench_config.tx_count,
|
||||||
&tx_params,
|
&tx_params,
|
||||||
|
|
|
@ -7,7 +7,7 @@ pub struct TenantConfig {
|
||||||
pub tenant_id: String,
|
pub tenant_id: String,
|
||||||
pub rpc_addr: String,
|
pub rpc_addr: String,
|
||||||
// needs to point to a reliable websocket server that can be used to get tx status
|
// needs to point to a reliable websocket server that can be used to get tx status
|
||||||
pub tx_status_ws_addr: String,
|
pub tx_status_ws_addr: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
// recommend to use one payer keypair for all targets and fund that keypair with enough SOL
|
// recommend to use one payer keypair for all targets and fund that keypair with enough SOL
|
||||||
|
@ -56,10 +56,9 @@ pub fn read_tenant_configs(env_vars: Vec<(String, String)>) -> Vec<TenantConfig>
|
||||||
.iter()
|
.iter()
|
||||||
.find(|(v, _)| *v == format!("TENANT{}_TX_STATUS_WS_ADDR", tc))
|
.find(|(v, _)| *v == format!("TENANT{}_TX_STATUS_WS_ADDR", tc))
|
||||||
.iter()
|
.iter()
|
||||||
.exactly_one()
|
.at_most_one()
|
||||||
.expect("need TENANT_X_TX_STATUS_WS_ADDR")
|
.expect("need TENANT_X_TX_STATUS_WS_ADDR")
|
||||||
.1
|
.map(|(_, v)| v.to_string())
|
||||||
.to_string(),
|
|
||||||
})
|
})
|
||||||
.collect::<Vec<TenantConfig>>();
|
.collect::<Vec<TenantConfig>>();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue