From 04b1bf382ba40563edba9117002118013c675b09 Mon Sep 17 00:00:00 2001 From: akorchyn Date: Tue, 24 Dec 2024 17:06:37 +0200 Subject: [PATCH] review, fixed batches --- .../account/view_account_summary/mod.rs | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/commands/account/view_account_summary/mod.rs b/src/commands/account/view_account_summary/mod.rs index b443b60d..bd1f8fc3 100644 --- a/src/commands/account/view_account_summary/mod.rs +++ b/src/commands/account/view_account_summary/mod.rs @@ -134,7 +134,7 @@ fn get_account_inquiry( std::collections::BTreeMap, > = match pools_to_query { Ok(validators) => { - let mut all_results = std::collections::BTreeMap::new(); + let mut all_results = Ok(std::collections::BTreeMap::new()); let validators: Vec<_> = validators.into_iter().collect(); for (batch_index, validator_batch) in validators @@ -171,11 +171,21 @@ fn get_account_inquiry( }) }) .try_collect::>(), - )?; + ); - all_results.extend(batch_results); + match batch_results { + Ok(batch_results) => { + let _ = all_results.as_mut().map(|all_results| { + all_results.extend(batch_results); + }); + } + Err(err) => { + all_results = Err(err); + break; + } + }; } - Ok(all_results) + all_results } Err(err) => Err(err), };