chore: rename strat into strategy to improve redability

`strat` is reported as error by typos
This commit is contained in:
Gwen Lg
2026-01-27 21:35:50 +01:00
parent 014bebfa1f
commit 32da94cbbe
2 changed files with 16 additions and 16 deletions
+9 -9
View File
@@ -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.
+7 -7
View File
@@ -162,7 +162,7 @@ impl RpcHelper {
endpoint: &Endpoint<M, H>,
to: Uuid,
msg: N,
strat: RequestStrategy<()>,
strategy: RequestStrategy<()>,
) -> Result<S, Error>
where
M: Rpc<Response = Result<S, Error>>,
@@ -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<M, H>,
to: &[Uuid],
msg: N,
strat: RequestStrategy<()>,
strategy: RequestStrategy<()>,
) -> Result<Vec<(Uuid, Result<S, Error>)>, Error>
where
M: Rpc<Response = Result<S, Error>>,
@@ -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<M, H>,
msg: N,
strat: RequestStrategy<()>,
strategy: RequestStrategy<()>,
) -> Result<Vec<(Uuid, Result<S, Error>)>, Error>
where
M: Rpc<Response = Result<S, Error>>,
@@ -266,7 +266,7 @@ impl RpcHelper {
.iter()
.map(|p| p.id.into())
.collect::<Vec<_>>();
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,