From 41a426b2dd6289e10cbec9cb337095977a676b79 Mon Sep 17 00:00:00 2001 From: eloylp Date: Tue, 5 Mar 2024 11:21:21 +0100 Subject: [PATCH] Simplify iterator use in msg processing Co-authored-by: tilacog --- ampd/src/handlers/solana_verify_msg.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ampd/src/handlers/solana_verify_msg.rs b/ampd/src/handlers/solana_verify_msg.rs index 00a9bee4e..7e43f808d 100644 --- a/ampd/src/handlers/solana_verify_msg.rs +++ b/ampd/src/handlers/solana_verify_msg.rs @@ -187,9 +187,10 @@ where let mut votes: Vec = Vec::new(); let mut ord_fut = FuturesOrdered::new(); - messages + let mut ord_fut: FuturesOrdered<_> = messages .iter() - .for_each(|msg| ord_fut.push_back(self.process_message(&msg, &source_gateway_address))); + .map(|msg| self.process_message(msg, &source_gateway_address)) + .collect(); while let Some(vote_result) = ord_fut.next().await { votes.push(vote_result?) // If there is a failure, its due to a network error, so we abort this handler operation and all messages need to be processed again.