fix some causes of start wonkiness on update (#2458)

* fix some causes of start wonkiness on update

* fix race condition with manager

Co-authored-by: J H <Blu-J@users.noreply.github.com>

* only restart if running

* fix start function

* clean up clode

* fix restart logic

---------

Co-authored-by: J H <Blu-J@users.noreply.github.com>
This commit is contained in:
Aiden McClelland
2023-10-16 12:34:12 -06:00
committed by GitHub
parent 5164c21923
commit 78faf888af
7 changed files with 108 additions and 91 deletions

View File

@@ -70,6 +70,12 @@ pub async fn canonicalize(
#[pin_project::pin_project(PinnedDrop)]
pub struct NonDetachingJoinHandle<T>(#[pin] JoinHandle<T>);
impl<T> NonDetachingJoinHandle<T> {
pub async fn wait_for_abort(self) -> Result<T, JoinError> {
self.abort();
self.await
}
}
impl<T> From<JoinHandle<T>> for NonDetachingJoinHandle<T> {
fn from(t: JoinHandle<T>) -> Self {
NonDetachingJoinHandle(t)

View File

@@ -80,6 +80,7 @@ pub enum ErrorKind {
Lshw = 68,
CpuSettings = 69,
Firmware = 70,
Timeout = 71,
}
impl ErrorKind {
pub fn as_str(&self) -> &'static str {
@@ -155,6 +156,7 @@ impl ErrorKind {
Lshw => "LSHW Error",
CpuSettings => "CPU Settings Error",
Firmware => "Firmware Error",
Timeout => "Timeout Error",
}
}
}