From 41dd12f09220c164347520dd0d341df0dba779fd Mon Sep 17 00:00:00 2001 From: Cyrix126 Date: Fri, 31 May 2024 17:34:10 +0200 Subject: [PATCH] fix: errors of xmrig not taken into account --- src/helper/xmrig.rs | 4 ++-- src/utils/regex.rs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/helper/xmrig.rs b/src/helper/xmrig.rs index 657c182..0533104 100644 --- a/src/helper/xmrig.rs +++ b/src/helper/xmrig.rs @@ -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 diff --git a/src/utils/regex.rs b/src/utils/regex.rs index ece50fa..2eb4079 100644 --- a/src/utils/regex.rs +++ b/src/utils/regex.rs @@ -210,8 +210,8 @@ pub fn estimated_hr(s: &str) -> Option { } None } -pub fn contains_connect_error(l: &str) -> bool { - static LINE_SHARE: Lazy = Lazy::new(|| Regex::new(r"connect error").unwrap()); +pub fn contains_error(l: &str) -> bool { + static LINE_SHARE: Lazy = Lazy::new(|| Regex::new(r"error").unwrap()); LINE_SHARE.is_match(l) } pub fn contains_usepool(l: &str) -> bool {