pid logic fixed
parent
ac0c3cb8c1
commit
75940cb187
|
|
@ -120,7 +120,7 @@ pub mod v2 {
|
|||
match freeze_process(&self.name).await {
|
||||
Ok(_) => {
|
||||
self.state = ProcessState::HoldingByCli;
|
||||
self.pid = Pid::new();
|
||||
// self.pid = Pid::new();
|
||||
},
|
||||
Err(er) => {
|
||||
error!("Cannot forcefully freeze process {} : {}", self.name, er);
|
||||
|
|
@ -134,7 +134,7 @@ pub mod v2 {
|
|||
match freeze_process(&self.name).await {
|
||||
Ok(_) => {
|
||||
self.state = ProcessState::Holding;
|
||||
self.pid = Pid::new();
|
||||
// self.pid = Pid::new();
|
||||
},
|
||||
Err(er) => {
|
||||
error!("Cannot freeze process {} : {}", self.name, er);
|
||||
|
|
@ -177,6 +177,11 @@ pub mod v2 {
|
|||
self.state = ProcessState::Pending;
|
||||
Ok(())
|
||||
}
|
||||
pub async fn restart_by_user_call(&mut self) -> anyhow::Result<()> {
|
||||
let pid = restart_process(&self.name, &self.bin).await?;
|
||||
self.pid = Pid(pid);
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
#[async_trait]
|
||||
|
|
@ -190,18 +195,22 @@ pub mod v2 {
|
|||
error!("Cannot unfreeze process {} : {}", self.name, er);
|
||||
} else {
|
||||
self.state = ProcessState::Pending;
|
||||
self.pid = Pid::new_from_output(get_pid(self.name.as_ref()).await);
|
||||
info!("{}: New PID - {}", self.name, self.pid);
|
||||
// self.pid = Pid::new_from_output(get_pid(self.name.as_ref()).await);
|
||||
// info!("{}: New PID - {}", self.name, self.pid);
|
||||
info!("Process {} was unfreezed", &self.name);
|
||||
}
|
||||
},
|
||||
ProcessState::Stopped => {
|
||||
info!("No negative dependecies events on {} process. Starting ...", self.name);
|
||||
if let Err(er) = start_process(&self.name, &self.bin).await {
|
||||
error!("Cannot start process {} : {}", self.name, er);
|
||||
} else {
|
||||
self.state = ProcessState::Pending;
|
||||
self.pid = Pid::new_from_output(get_pid(self.name.as_ref()).await);
|
||||
info!("{}: New PID - {}", self.name, self.pid);
|
||||
match start_process(&self.name, &self.bin).await {
|
||||
Ok(pid) => {
|
||||
self.state = ProcessState::Pending;
|
||||
self.pid = Pid(pid);
|
||||
info!("{}: New PID - {}", self.name, self.pid);
|
||||
},
|
||||
Err(er) => {
|
||||
error!("Cannot start process {} : {}", self.name, er);
|
||||
},
|
||||
}
|
||||
},
|
||||
_ => {},
|
||||
|
|
|
|||
Loading…
Reference in New Issue