conditional start

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

View File

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