useless loops are died but BUG is still here
parent
f0fe76aa1f
commit
e29140657a
13
src/main.rs
13
src/main.rs
|
|
@ -262,7 +262,6 @@ async fn start_process(name: &str, path: &str) -> Result<(), CustomError> {
|
|||
}
|
||||
// check process status daemon
|
||||
async fn running_handler(name: &str, path: &str, tx: mpsc::Sender<u8>){
|
||||
loop {
|
||||
// println!("running daemon on {}", name);
|
||||
let _ = Command::new("pidof")
|
||||
.arg(name)
|
||||
|
|
@ -278,14 +277,11 @@ async fn running_handler(name: &str, path: &str, tx: mpsc::Sender<u8>){
|
|||
}
|
||||
}
|
||||
tokio::time::sleep(Duration::from_millis(100)).await;
|
||||
}
|
||||
}
|
||||
|
||||
async fn file_handler(name: &str, files: &Vec<Files>, tx: mpsc::Sender<u8>) {
|
||||
loop {
|
||||
// println!("file daemon on {}", name);
|
||||
if is_active(name) {
|
||||
let mut er = 0;
|
||||
for file in files {
|
||||
match check_file(&file.filename, &file.src) {
|
||||
Ok(_) => {
|
||||
|
|
@ -297,12 +293,10 @@ async fn file_handler(name: &str, files: &Vec<Files>, tx: mpsc::Sender<u8>) {
|
|||
continue;
|
||||
},
|
||||
"stop" => {
|
||||
er += 1;
|
||||
tx.send(1).await.unwrap();
|
||||
break;
|
||||
return;
|
||||
},
|
||||
"hold" => {
|
||||
er += 1;
|
||||
tx.send(2).await.unwrap();
|
||||
break;
|
||||
},
|
||||
|
|
@ -314,12 +308,11 @@ async fn file_handler(name: &str, files: &Vec<Files>, tx: mpsc::Sender<u8>) {
|
|||
},
|
||||
}
|
||||
}
|
||||
if is_frozen(name) && er == 0 {
|
||||
if is_frozen(name) {
|
||||
tx.send(10).await.unwrap();
|
||||
}
|
||||
}
|
||||
tokio::time::sleep(Duration::from_millis(100)).await;
|
||||
}
|
||||
}
|
||||
fn check_file(filename: &str, path: &str) -> Result<(), CustomError> {
|
||||
let fileconcat = format!("{}{}", path, filename);
|
||||
|
|
@ -333,7 +326,6 @@ fn check_file(filename: &str, path: &str) -> Result<(), CustomError> {
|
|||
|
||||
// ??
|
||||
async fn service_handler(name: &str, services: &Vec<Services>, tx: mpsc::Sender<u8>) {
|
||||
loop {
|
||||
// println!("service daemon on {}", name);
|
||||
if is_active(name) {
|
||||
let mut er = 0;
|
||||
|
|
@ -385,7 +377,6 @@ async fn service_handler(name: &str, services: &Vec<Services>, tx: mpsc::Sender<
|
|||
}
|
||||
}
|
||||
tokio::time::sleep(Duration::from_millis(100)).await;
|
||||
}
|
||||
}
|
||||
|
||||
async fn looped_service_connecting(
|
||||
|
|
|
|||
Loading…
Reference in New Issue