From 721fa6c758f1bed4300f9bd17e20609bd737ad02 Mon Sep 17 00:00:00 2001 From: prplV Date: Thu, 10 Apr 2025 08:58:40 -0400 Subject: [PATCH] prc state check logic fixed without code repeating --- noxis-rs/src/utils/prcs.rs | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/noxis-rs/src/utils/prcs.rs b/noxis-rs/src/utils/prcs.rs index 726d703..22eca4a 100644 --- a/noxis-rs/src/utils/prcs.rs +++ b/noxis-rs/src/utils/prcs.rs @@ -48,22 +48,20 @@ pub mod v2 { }, } } - match self.state { - ProcessState::Holding => { - if self.negative_events.len() == 0 { + if self.negative_events.len() == 0 { + match self.state { + ProcessState::Holding => { info!("No negative dependecies events on {} process. Unfreezing ...", self.name); unfreeze_process(self.name).await; - } - }, - ProcessState::Stopped => { - if self.negative_events.len() == 0 { + }, + ProcessState::Stopped => { info!("No negative dependecies events on {} process. Starting ...", self.name); if let Err(_) = start_process(self.name, &self.obj.path).await { error!("Cannot start process {} due to {}", self.name, "system unrecognized error"); } - } - }, - _ => {}, + }, + _ => {}, + } } }