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": {
"name": "@start9labs/start-sdk",
"version": "0.4.0-beta.62",
"version": "0.4.0-beta.64",
"license": "MIT",
"dependencies": {
"@iarna/toml": "^3.0.0",

View File

@@ -673,16 +673,8 @@ impl Service {
#[instrument(skip_all)]
pub async fn backup(&self, guard: impl GenericMountGuard) -> Result<(), Error> {
let id = &self.seed.id;
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?;
// TODO: reverify?
// Prepare the backup future in the actor first, so the cell is
// populated before the actor reacts to the DesiredStatus change.
let backup = self
.actor
.send(
@@ -692,6 +684,8 @@ impl Service {
},
)
.await??;
// Set status early so the UI reflects "backing up" while the s9pk
// serialization and service stop happen concurrently.
self.seed
.ctx
.db
@@ -706,6 +700,15 @@ impl Service {
})
.await
.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
}