misc bugfixes for alpha.4 (#2953)

* fix lockup when stop during init

* Fix incorrect description for registry package remove command

* alpha.5

* beta.25

---------

Co-authored-by: Mariusz Kogen <k0gen@pm.me>
This commit is contained in:
Aiden McClelland
2025-05-23 11:23:29 -06:00
committed by GitHub
parent b1f9f90fec
commit 90e61989a4
19 changed files with 120 additions and 85 deletions

2
core/Cargo.lock generated
View File

@@ -6023,7 +6023,7 @@ checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3"
[[package]]
name = "start-os"
version = "0.4.0-alpha.4"
version = "0.4.0-alpha.5"
dependencies = [
"aes 0.7.5",
"async-acme",

View File

@@ -14,7 +14,7 @@ keywords = [
name = "start-os"
readme = "README.md"
repository = "https://github.com/Start9Labs/start-os"
version = "0.4.0-alpha.4" # VERSION_BUMP
version = "0.4.0-alpha.5" # VERSION_BUMP
license = "MIT"
[lib]

View File

@@ -31,13 +31,12 @@ pub async fn start(ctx: RpcContext, ControlParams { id }: ControlParams) -> Resu
}
pub async fn stop(ctx: RpcContext, ControlParams { id }: ControlParams) -> Result<(), Error> {
// TODO: why did this return last_status before?
ctx.services
.get(&id)
.await
.as_ref()
.ok_or_else(|| Error::new(eyre!("Manager not found"), crate::ErrorKind::InvalidRequest))?
.stop(Guid::new())
.stop(Guid::new(), true)
.await?;
Ok(())

View File

@@ -35,7 +35,7 @@ pub fn package_api<C: Context>() -> ParentHandler<C> {
"remove",
from_fn_async(add::remove_package)
.no_display()
.with_about("Add package to registry index")
.with_about("Remove package from registry index")
.with_call_remote::<CliContext>(),
)
.subcommand(

View File

@@ -1,3 +1,5 @@
use futures::future::OptionFuture;
use crate::prelude::*;
use crate::rpc_continuations::Guid;
use crate::service::action::RunAction;
@@ -26,13 +28,20 @@ impl Service {
}
}
struct Stop;
struct Stop {
wait: bool,
}
impl Handler<Stop> for ServiceActor {
type Response = ();
fn conflicts_with(_: &Stop) -> ConflictBuilder<Self> {
ConflictBuilder::everything().except::<RunAction>()
}
async fn handle(&mut self, _: Guid, _: Stop, _: &BackgroundJobQueue) -> Self::Response {
async fn handle(
&mut self,
_: Guid,
Stop { wait }: Stop,
_: &BackgroundJobQueue,
) -> Self::Response {
let mut transition_state = None;
self.0.persistent_container.state.send_modify(|x| {
x.desired_state = StartStop::Stop;
@@ -40,14 +49,19 @@ impl Handler<Stop> for ServiceActor {
transition_state = std::mem::take(&mut x.transition_state);
}
});
let notif = if wait {
Some(self.0.synchronized.notified())
} else {
None
};
if let Some(restart) = transition_state {
restart.abort().await;
}
self.0.synchronized.notified().await
OptionFuture::from(notif).await;
}
}
impl Service {
pub async fn stop(&self, id: Guid) -> Result<(), Error> {
self.actor.send(id, Stop).await
pub async fn stop(&self, id: Guid, wait: bool) -> Result<(), Error> {
self.actor.send(id, Stop { wait }).await
}
}

View File

@@ -262,7 +262,7 @@ async fn create_task(
None => true,
};
if active && task.severity == TaskSeverity::Critical {
context.stop(procedure_id).await?;
context.stop(procedure_id, false).await?;
}
context
.seed

View File

@@ -35,7 +35,7 @@ pub async fn shutdown(
ProcedureId { procedure_id }: ProcedureId,
) -> Result<(), Error> {
let context = context.deref()?;
context.stop(procedure_id).await?;
context.stop(procedure_id, false).await?;
Ok(())
}

View File

@@ -44,8 +44,9 @@ mod v0_4_0_alpha_1;
mod v0_4_0_alpha_2;
mod v0_4_0_alpha_3;
mod v0_4_0_alpha_4;
mod v0_4_0_alpha_5;
pub type Current = v0_4_0_alpha_4::Version; // VERSION_BUMP
pub type Current = v0_4_0_alpha_5::Version; // VERSION_BUMP
impl Current {
#[instrument(skip(self, db))]
@@ -153,7 +154,8 @@ enum Version {
V0_4_0_alpha_1(Wrapper<v0_4_0_alpha_1::Version>),
V0_4_0_alpha_2(Wrapper<v0_4_0_alpha_2::Version>),
V0_4_0_alpha_3(Wrapper<v0_4_0_alpha_3::Version>),
V0_4_0_alpha_4(Wrapper<v0_4_0_alpha_4::Version>), // VERSION_BUMP
V0_4_0_alpha_4(Wrapper<v0_4_0_alpha_4::Version>),
V0_4_0_alpha_5(Wrapper<v0_4_0_alpha_5::Version>), // VERSION_BUMP
Other(exver::Version),
}
@@ -200,7 +202,8 @@ impl Version {
Self::V0_4_0_alpha_1(v) => DynVersion(Box::new(v.0)),
Self::V0_4_0_alpha_2(v) => DynVersion(Box::new(v.0)),
Self::V0_4_0_alpha_3(v) => DynVersion(Box::new(v.0)),
Self::V0_4_0_alpha_4(v) => DynVersion(Box::new(v.0)), // VERSION_BUMP
Self::V0_4_0_alpha_4(v) => DynVersion(Box::new(v.0)),
Self::V0_4_0_alpha_5(v) => DynVersion(Box::new(v.0)), // VERSION_BUMP
Self::Other(v) => {
return Err(Error::new(
eyre!("unknown version {v}"),
@@ -239,7 +242,8 @@ impl Version {
Version::V0_4_0_alpha_1(Wrapper(x)) => x.semver(),
Version::V0_4_0_alpha_2(Wrapper(x)) => x.semver(),
Version::V0_4_0_alpha_3(Wrapper(x)) => x.semver(),
Version::V0_4_0_alpha_4(Wrapper(x)) => x.semver(), // VERSION_BUMP
Version::V0_4_0_alpha_4(Wrapper(x)) => x.semver(),
Version::V0_4_0_alpha_5(Wrapper(x)) => x.semver(), // VERSION_BUMP
Version::Other(x) => x.clone(),
}
}

View File

@@ -0,0 +1,38 @@
use exver::{PreReleaseSegment, VersionRange};
use super::v0_3_5::V0_3_0_COMPAT;
use super::{v0_4_0_alpha_4, VersionT};
use crate::context::RpcContext;
use crate::prelude::*;
lazy_static::lazy_static! {
static ref V0_4_0_alpha_5: exver::Version = exver::Version::new(
[0, 4, 0],
[PreReleaseSegment::String("alpha".into()), 5.into()]
);
}
#[derive(Clone, Copy, Debug, Default)]
pub struct Version;
impl VersionT for Version {
type Previous = v0_4_0_alpha_4::Version;
type PreUpRes = ();
async fn pre_up(self) -> Result<Self::PreUpRes, Error> {
Ok(())
}
fn semver(self) -> exver::Version {
V0_4_0_alpha_5.clone()
}
fn compat(self) -> &'static VersionRange {
&V0_3_0_COMPAT
}
#[instrument]
fn up(self, _db: &mut Value, _: Self::PreUpRes) -> Result<(), Error> {
Ok(())
}
fn down(self, _db: &mut Value) -> Result<(), Error> {
Ok(())
}
}