Skip to content

Commit

Permalink
Fix unnecesary iter conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
IAvecilla committed Mar 11, 2024
1 parent dc8289b commit d37329f
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions node/tools/src/k8s.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ pub async fn get_consensus_nodes_address(client: &Client) -> anyhow::Result<Vec<
"No consensus pods found in the k8s cluster"
);
let mut node_rpc_addresses: Vec<SocketAddr> = Vec::new();
for pod in pods.into_iter() {
for pod in pods {
let pod_spec = pod.spec.as_ref().context("Failed to get pod spec")?;
let pod_container = pod_spec
.containers
Expand All @@ -68,11 +68,11 @@ pub async fn get_consensus_nodes_address(client: &Client) -> anyhow::Result<Vec<
.context("Failed to get ports of container")?
.iter()
.find_map(|port| {
let port: u16 = port.container_port.try_into().ok()?;
(port != config::NODES_PORT).then_some(port)
let port: u8 = port.container_port.try_into().ok()?;
(port != config::NODES_PORT as u8).then_some(port)
})
.context("Failed parsing container port")?;
node_rpc_addresses.push(SocketAddr::new(pod_ip.parse()?, pod_rpc_port));
node_rpc_addresses.push(SocketAddr::new(pod_ip.parse()?, pod_rpc_port as u16));
}
}
Ok(node_rpc_addresses)
Expand Down

0 comments on commit d37329f

Please sign in to comment.