conditional start

This commit is contained in:
Jonathan Baecker 2024-09-30 18:15:17 +02:00
parent 2f5911fd35
commit c3da356bc7

View File

@ -955,9 +955,11 @@ pub async fn process_control(
}
}
ProcessCtl::Start => {
if !manager.is_alive.load(Ordering::SeqCst) {
manager.channel.lock().unwrap().active = true;
manager.async_start().await;
}
}
ProcessCtl::Stop => {
manager.channel.lock().unwrap().active = false;
manager.async_stop().await;
@ -965,9 +967,12 @@ pub async fn process_control(
ProcessCtl::Restart => {
manager.async_stop().await;
tokio::time::sleep(tokio::time::Duration::from_millis(1500)).await;
if !manager.is_alive.load(Ordering::SeqCst) {
manager.async_start().await;
}
}
}
Ok(web::Json("Success"))
}