fix: log process name and sending update node to XvB when p2pool is the faulty one.

This commit is contained in:
Louis-Marie Baer 2024-07-24 20:49:49 +02:00
parent ed122e940d
commit c4d1eda590
2 changed files with 12 additions and 6 deletions

View file

@ -70,7 +70,11 @@ impl Helper {
// updating current node to None, will stop sending signal of FailedNode until new node is set // updating current node to None, will stop sending signal of FailedNode until new node is set
// send signal to update node. // send signal to update node.
warn!("XMRig PTY Parse | node is offline, sending signal to update nodes."); warn!("XMRig PTY Parse | node is offline, sending signal to update nodes.");
// update nodes only if we were not mining on p2pool.
// if xmrig stop, xvb will react in any case.
if current_node != XvbNode::P2pool {
lock!(process_xvb).signal = ProcessSignal::UpdateNodes(current_node); lock!(process_xvb).signal = ProcessSignal::UpdateNodes(current_node);
}
lock!(pub_api_xvb).current_node = None; lock!(pub_api_xvb).current_node = None;
} }
} }

View file

@ -72,7 +72,9 @@ impl Helper {
warn!( warn!(
"XMRig-Proxy PTY Parse | node is offline, sending signal to update nodes." "XMRig-Proxy PTY Parse | node is offline, sending signal to update nodes."
); );
if current_node != XvbNode::P2pool {
lock!(process_xvb).signal = ProcessSignal::UpdateNodes(current_node); lock!(process_xvb).signal = ProcessSignal::UpdateNodes(current_node);
}
lock!(pub_api_xvb).current_node = None; lock!(pub_api_xvb).current_node = None;
} }
} }
@ -212,7 +214,7 @@ impl Helper {
state_xmrig: &Xmrig, state_xmrig: &Xmrig,
path: &Path, path: &Path,
) { ) {
info!("XMRig | Attempting to restart..."); info!("XMRig-Proxy | Attempting to restart...");
lock2!(helper, xmrig_proxy).state = ProcessState::Middle; lock2!(helper, xmrig_proxy).state = ProcessState::Middle;
lock2!(helper, xmrig_proxy).signal = ProcessSignal::Restart; lock2!(helper, xmrig_proxy).signal = ProcessSignal::Restart;
@ -227,10 +229,10 @@ impl Helper {
sleep!(1000); sleep!(1000);
} }
// Ok, process is not alive, start the new one! // Ok, process is not alive, start the new one!
info!("XMRig_proxy | Old process seems dead, starting new one!"); info!("XMRig-Proxy | Old process seems dead, starting new one!");
Self::start_xp(&helper, &state, &state_xmrig, &path); Self::start_xp(&helper, &state, &state_xmrig, &path);
}); });
info!("XMRig | Restart ... OK"); info!("XMRig-Proxy | Restart ... OK");
} }
pub fn start_xp( pub fn start_xp(
helper: &Arc<Mutex<Self>>, helper: &Arc<Mutex<Self>>,
@ -354,7 +356,7 @@ impl Helper {
if let Err(e) = writeln!(stdin, "c") { if let Err(e) = writeln!(stdin, "c") {
error!("P2Pool Watchdog | STDIN error: {}", e); error!("P2Pool Watchdog | STDIN error: {}", e);
} }
info!("XMRig | Entering watchdog mode... woof!"); info!("XMRig-Proxy | Entering watchdog mode... woof!");
loop { loop {
let now = Instant::now(); let now = Instant::now();
debug!("XMRig-Proxy Watchdog | ----------- Start of loop -----------"); debug!("XMRig-Proxy Watchdog | ----------- Start of loop -----------");