Skip to content

Commit

Permalink
Simplify iterator use in msg processing
Browse files Browse the repository at this point in the history
Co-authored-by: tilacog <[email protected]>
  • Loading branch information
eloylp and tilacog authored Mar 5, 2024
1 parent dce45b0 commit 41a426b
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions ampd/src/handlers/solana_verify_msg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -187,9 +187,10 @@ where
let mut votes: Vec<Vote> = 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.
Expand Down

0 comments on commit 41a426b

Please sign in to comment.