mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-04-04 22:39:46 +00:00
fix: Manager's exit not stopping (#2104)
This commit is contained in:
@@ -327,7 +327,6 @@ impl Manager {
|
|||||||
}) => (), // Already stopped
|
}) => (), // Already stopped
|
||||||
a => a?,
|
a => a?,
|
||||||
};
|
};
|
||||||
|
|
||||||
self.shared.killer.notify_waiters();
|
self.shared.killer.notify_waiters();
|
||||||
|
|
||||||
if let Some(thread) = self.thread.take().await {
|
if let Some(thread) = self.thread.take().await {
|
||||||
@@ -644,9 +643,23 @@ async fn get_running_ip(
|
|||||||
if let Poll::Ready(res) = futures::poll!(&mut runtime) {
|
if let Poll::Ready(res) = futures::poll!(&mut runtime) {
|
||||||
match res {
|
match res {
|
||||||
Ok(Ok(response)) => return GetRunningIp::EarlyExit(response),
|
Ok(Ok(response)) => return GetRunningIp::EarlyExit(response),
|
||||||
Err(_) | Ok(Err(_)) => {
|
Err(e) => {
|
||||||
return GetRunningIp::Error(Error::new(
|
return GetRunningIp::Error(Error::new(
|
||||||
eyre!("Manager runtime panicked!"),
|
match e.try_into_panic() {
|
||||||
|
Ok(e) => {
|
||||||
|
eyre!(
|
||||||
|
"Manager runtime panicked: {}",
|
||||||
|
e.downcast_ref::<&'static str>().unwrap_or(&"UNKNOWN")
|
||||||
|
)
|
||||||
|
}
|
||||||
|
_ => eyre!("Manager runtime cancelled!"),
|
||||||
|
},
|
||||||
|
crate::ErrorKind::Docker,
|
||||||
|
))
|
||||||
|
}
|
||||||
|
Ok(Err(e)) => {
|
||||||
|
return GetRunningIp::Error(Error::new(
|
||||||
|
eyre!("Manager runtime returned error: {}", e),
|
||||||
crate::ErrorKind::Docker,
|
crate::ErrorKind::Docker,
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
@@ -772,12 +785,11 @@ async fn stop(shared: &ManagerSharedState) -> Result<(), Error> {
|
|||||||
shared
|
shared
|
||||||
.commit_health_check_results
|
.commit_health_check_results
|
||||||
.store(false, Ordering::SeqCst);
|
.store(false, Ordering::SeqCst);
|
||||||
shared.on_stop.send(OnStop::Sleep).map_err(|_| {
|
shared.on_stop.send_modify(|status| {
|
||||||
Error::new(
|
if matches!(*status, OnStop::Restart) {
|
||||||
eyre!("Manager has already been shutdown"),
|
*status = OnStop::Sleep;
|
||||||
crate::ErrorKind::Docker,
|
}
|
||||||
)
|
});
|
||||||
})?;
|
|
||||||
if *shared.status.1.borrow() == Status::Paused {
|
if *shared.status.1.borrow() == Status::Paused {
|
||||||
resume(shared).await?;
|
resume(shared).await?;
|
||||||
}
|
}
|
||||||
@@ -794,12 +806,11 @@ async fn stop(shared: &ManagerSharedState) -> Result<(), Error> {
|
|||||||
|
|
||||||
#[instrument(skip(shared))]
|
#[instrument(skip(shared))]
|
||||||
async fn start(shared: &ManagerSharedState) -> Result<(), Error> {
|
async fn start(shared: &ManagerSharedState) -> Result<(), Error> {
|
||||||
shared.on_stop.send(OnStop::Restart).map_err(|_| {
|
shared.on_stop.send_modify(|status| {
|
||||||
Error::new(
|
if matches!(*status, OnStop::Sleep) {
|
||||||
eyre!("Manager has already been shutdown"),
|
*status = OnStop::Restart;
|
||||||
crate::ErrorKind::Docker,
|
}
|
||||||
)
|
});
|
||||||
})?;
|
|
||||||
let _ = shared.status.0.send_modify(|x| {
|
let _ = shared.status.0.send_modify(|x| {
|
||||||
if *x != Status::Running {
|
if *x != Status::Running {
|
||||||
*x = Status::Starting
|
*x = Status::Starting
|
||||||
|
|||||||
Reference in New Issue
Block a user