diff --git a/examples/rust/src/bin/client.rs b/examples/rust/src/bin/client.rs index b27bde14..3d6a8d58 100644 --- a/examples/rust/src/bin/client.rs +++ b/examples/rust/src/bin/client.rs @@ -107,9 +107,9 @@ struct ActionSubscribe { #[clap(long)] accounts_account: Vec, - /// Path to a json array of account addresses + /// Path to a JSON array of account addresses #[clap(long)] - accounts_accounts_path: Option, + accounts_account_path: Option, /// Filter by Owner Pubkey #[clap(long)] @@ -204,7 +204,7 @@ struct ActionSubscribe { } impl Action { - fn get_subscribe_request( + async fn get_subscribe_request( &self, commitment: Option, ) -> anyhow::Result> { @@ -213,9 +213,11 @@ impl Action { let mut accounts: AccountFilterMap = HashMap::new(); if args.accounts { let mut accounts_account = args.accounts_account.clone(); - if let Some(path) = args.accounts_accounts_path.as_ref() { - let file = File::open(path)?; - let accounts: Vec = serde_json::from_reader(file)?; + if let Some(path) = args.accounts_account_path.clone() { + let accounts = tokio::task::block_in_place(move || { + let file = File::open(path)?; + Ok::, anyhow::Error>(serde_json::from_reader(file)?) + })?; accounts_account.extend(accounts); } @@ -475,6 +477,7 @@ async fn main() -> anyhow::Result<()> { let (request, resub) = args .action .get_subscribe_request(commitment) + .await .map_err(backoff::Error::Permanent)? .expect("expect subscribe action");