fix: backup status reporting

This commit is contained in:
Aiden McClelland
2026-03-22 23:55:26 -06:00
parent 7ffb462355
commit 25aa140174
2 changed files with 14 additions and 11 deletions

View File

@@ -37,7 +37,7 @@
}, },
"../sdk/dist": { "../sdk/dist": {
"name": "@start9labs/start-sdk", "name": "@start9labs/start-sdk",
"version": "0.4.0-beta.62", "version": "0.4.0-beta.64",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@iarna/toml": "^3.0.0", "@iarna/toml": "^3.0.0",

View File

@@ -673,16 +673,8 @@ impl Service {
#[instrument(skip_all)] #[instrument(skip_all)]
pub async fn backup(&self, guard: impl GenericMountGuard) -> Result<(), Error> { pub async fn backup(&self, guard: impl GenericMountGuard) -> Result<(), Error> {
let id = &self.seed.id; let id = &self.seed.id;
let mut file = // Prepare the backup future in the actor first, so the cell is
AtomicFile::new(guard.path().join(id).with_extension("s9pk"), None::<&str>).await?; // populated before the actor reacts to the DesiredStatus change.
self.seed
.persistent_container
.s9pk
.clone()
.serialize(&mut *file, true)
.await?;
file.save().await?;
// TODO: reverify?
let backup = self let backup = self
.actor .actor
.send( .send(
@@ -692,6 +684,8 @@ impl Service {
}, },
) )
.await??; .await??;
// Set status early so the UI reflects "backing up" while the s9pk
// serialization and service stop happen concurrently.
self.seed self.seed
.ctx .ctx
.db .db
@@ -706,6 +700,15 @@ impl Service {
}) })
.await .await
.result?; .result?;
let mut file =
AtomicFile::new(guard.path().join(id).with_extension("s9pk"), None::<&str>).await?;
self.seed
.persistent_container
.s9pk
.clone()
.serialize(&mut *file, true)
.await?;
file.save().await?;
backup.await backup.await
} }