fix: errors of xmrig not taken into account

This commit is contained in:
Cyrix126 2024-05-31 17:34:10 +02:00
parent 376de4e7e3
commit 41dd12f092
2 changed files with 4 additions and 4 deletions

View file

@ -1,5 +1,5 @@
use crate::helper::{ProcessName, ProcessSignal, ProcessState};
use crate::regex::{contains_connect_error, contains_usepool, detect_new_node_xmrig, XMRIG_REGEX};
use crate::regex::{contains_error, contains_usepool, detect_new_node_xmrig, XMRIG_REGEX};
use crate::utils::human::HumanNumber;
use crate::utils::sudo::SudoState;
use crate::{constants::*, macros::*};
@ -59,7 +59,7 @@ impl Helper {
while let Some(Ok(line)) = stdout.next() {
// need to verify if node still working
// for that need to catch "connect error"
if contains_connect_error(&line) {
if contains_error(&line) {
let current_node = lock!(pub_api_xvb).current_node;
if let Some(current_node) = current_node {
// updating current node to None, will stop sending signal of FailedNode until new node is set

View file

@ -210,8 +210,8 @@ pub fn estimated_hr(s: &str) -> Option<f32> {
}
None
}
pub fn contains_connect_error(l: &str) -> bool {
static LINE_SHARE: Lazy<Regex> = Lazy::new(|| Regex::new(r"connect error").unwrap());
pub fn contains_error(l: &str) -> bool {
static LINE_SHARE: Lazy<Regex> = Lazy::new(|| Regex::new(r"error").unwrap());
LINE_SHARE.is_match(l)
}
pub fn contains_usepool(l: &str) -> bool {