fix: clippy

This commit is contained in:
Louis-Marie Baer 2024-07-24 21:34:34 +02:00
parent e0d8b1efde
commit 8f669aa105
2 changed files with 35 additions and 38 deletions

View file

@ -5,7 +5,7 @@ mod test {
use crate::helper::xvb::algorithm::Algorithm;
use crate::helper::{
p2pool::{PrivP2poolLocalApi, PrivP2poolNetworkApi},
xvb::{priv_stats::RuntimeDonationLevel, priv_stats::RuntimeMode, rounds::round_type},
xvb::{priv_stats::RuntimeDonationLevel, priv_stats::RuntimeMode},
Helper, Process, ProcessName, ProcessState,
};
@ -511,9 +511,8 @@ Uptime = 0h 2m 4s
use crate::{
disk::state::P2pool,
helper::{p2pool::PubP2poolApi, xrig::xmrig::PubXmrigApi, xvb::rounds::XvbRound},
helper::{p2pool::PubP2poolApi, xrig::xmrig::PubXmrigApi},
macros::lock,
XVB_TIME_ALGO,
};
use crate::helper::xvb::{public_stats::XvbPubStats, PubXvbApi};

View file

@ -782,43 +782,41 @@ fn signal_interrupt(
// can update xmrig and check status of state in the same time.
// Need to set XMRig to P2Pool if it wasn't. XMRig should have populated this value at his start.
// but if xmrig didn't start, don't update it.
if lock!(process_xrig).state == ProcessState::Alive {
if lock!(gui_api).current_node != Some(XvbNode::P2pool) {
spawn(enc!((client, token_xmrig, address, gui_api_xmrig, gui_api_xp, gui_api) async move{
let url_api = api_url_xmrig(xp_alive, true);
warn!("update xmrig to use node ?");
if let Err(err) = update_xmrig_config(
&client,
&url_api,
&token_xmrig,
&XvbNode::P2pool,
&address,
&rig
)
.await {
let msg_xmrig_or_proxy = if xp_alive {
"XMRig-Proxy"
} else {
"XMRig"
};
output_console(
&mut lock!(gui_api).output,
&format!(
"Failure to update {msg_xmrig_or_proxy} config with HTTP API.\nError: {}",
err
), ProcessName::Xvb
);
if lock!(process_xrig).state == ProcessState::Alive && lock!(gui_api).current_node != Some(XvbNode::P2pool) {
spawn(enc!((client, token_xmrig, address, gui_api_xmrig, gui_api_xp, gui_api) async move{
let url_api = api_url_xmrig(xp_alive, true);
warn!("update xmrig to use node ?");
if let Err(err) = update_xmrig_config(
&client,
&url_api,
&token_xmrig,
&XvbNode::P2pool,
&address,
&rig
)
.await {
let msg_xmrig_or_proxy = if xp_alive {
"XMRig-Proxy"
} else {
// update node xmrig
if xp_alive {
lock!(gui_api_xp).node = XvbNode::P2pool.to_string();
} else {
lock!(gui_api_xmrig).node = XvbNode::P2pool.to_string();
};
}
"XMRig"
};
output_console(
&mut lock!(gui_api).output,
&format!(
"Failure to update {msg_xmrig_or_proxy} config with HTTP API.\nError: {}",
err
), ProcessName::Xvb
);
} else {
// update node xmrig
if xp_alive {
lock!(gui_api_xp).node = XvbNode::P2pool.to_string();
} else {
lock!(gui_api_xmrig).node = XvbNode::P2pool.to_string();
};
}
));}
}
}
));}
},
_ => {}
} } ),