From 32da94cbbe36b23b940c0c3164e5188ec741bc0c Mon Sep 17 00:00:00 2001 From: Gwen Lg Date: Tue, 27 Jan 2026 21:35:50 +0100 Subject: [PATCH] chore: rename strat into strategy to improve redability `strat` is reported as error by typos --- src/net/peering.rs | 18 +++++++++--------- src/rpc/rpc_helper.rs | 14 +++++++------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/net/peering.rs b/src/net/peering.rs index 02c1f3c3..5d942b5c 100644 --- a/src/net/peering.rs +++ b/src/net/peering.rs @@ -236,7 +236,7 @@ impl PeeringManager { ); known_hosts.update_hash(); - let strat = Arc::new(Self { + let strategy = Arc::new(Self { netapp: netapp.clone(), known_hosts: RwLock::new(known_hosts), public_peer_list: ArcSwap::new(Arc::new(Vec::new())), @@ -246,22 +246,22 @@ impl PeeringManager { ping_timeout_millis: DEFAULT_PING_TIMEOUT_MILLIS.into(), }); - strat.update_public_peer_list(&strat.known_hosts.read().unwrap()); + strategy.update_public_peer_list(&strategy.known_hosts.read().unwrap()); - strat.ping_endpoint.set_handler(strat.clone()); - strat.peer_list_endpoint.set_handler(strat.clone()); + strategy.ping_endpoint.set_handler(strategy.clone()); + strategy.peer_list_endpoint.set_handler(strategy.clone()); - let strat2 = strat.clone(); + let strategy2 = strategy.clone(); netapp.on_connected(move |id: NodeID, addr: SocketAddr, is_incoming: bool| { - strat2.on_connected(id, addr, is_incoming); + strategy2.on_connected(id, addr, is_incoming); }); - let strat2 = strat.clone(); + let strategy2 = strategy.clone(); netapp.on_disconnected(move |id: NodeID, is_incoming: bool| { - strat2.on_disconnected(id, is_incoming); + strategy2.on_disconnected(id, is_incoming); }); - strat + strategy } /// Run the full mesh peering strategy. diff --git a/src/rpc/rpc_helper.rs b/src/rpc/rpc_helper.rs index 35d0670b..78359762 100644 --- a/src/rpc/rpc_helper.rs +++ b/src/rpc/rpc_helper.rs @@ -162,7 +162,7 @@ impl RpcHelper { endpoint: &Endpoint, to: Uuid, msg: N, - strat: RequestStrategy<()>, + strategy: RequestStrategy<()>, ) -> Result where M: Rpc>, @@ -185,12 +185,12 @@ impl RpcHelper { let node_id = to.into(); let rpc_call = endpoint - .call_streaming(&node_id, msg, strat.rs_priority) + .call_streaming(&node_id, msg, strategy.rs_priority) .with_context(Context::current_with_span(span)) .record_duration(&self.0.metrics.rpc_duration, &metric_tags); let timeout = async { - match strat.rs_timeout { + match strategy.rs_timeout { Timeout::None => futures::future::pending().await, Timeout::Default => tokio::time::sleep(self.0.rpc_timeout).await, Timeout::Custom(t) => tokio::time::sleep(t).await, @@ -222,7 +222,7 @@ impl RpcHelper { endpoint: &Endpoint, to: &[Uuid], msg: N, - strat: RequestStrategy<()>, + strategy: RequestStrategy<()>, ) -> Result)>, Error> where M: Rpc>, @@ -237,7 +237,7 @@ impl RpcHelper { let resps = join_all( to.iter() - .map(|to| self.call(endpoint, *to, msg.clone(), strat.clone())), + .map(|to| self.call(endpoint, *to, msg.clone(), strategy.clone())), ) .with_context(Context::current_with_span(span)) .await; @@ -252,7 +252,7 @@ impl RpcHelper { &self, endpoint: &Endpoint, msg: N, - strat: RequestStrategy<()>, + strategy: RequestStrategy<()>, ) -> Result)>, Error> where M: Rpc>, @@ -266,7 +266,7 @@ impl RpcHelper { .iter() .map(|p| p.id.into()) .collect::>(); - self.call_many(endpoint, &to[..], msg, strat).await + self.call_many(endpoint, &to[..], msg, strategy).await } /// Make a RPC call to multiple servers, returning either a Vec of responses,