fix: set backup progress complete atomically with status revert

Move BackupProgress { complete: true } into the same db.mutate() as the
DesiredStatus revert in the backup transition. Previously these were
separate mutations—the status would revert to Running before progress
showed complete, causing a visible gap in the UI.
This commit is contained in:
Aiden McClelland
2026-03-23 01:15:54 -06:00
parent 2aa910a3e8
commit f60a1a9ed0
2 changed files with 15 additions and 17 deletions

View File

@@ -278,22 +278,6 @@ async fn perform_backup(
timestamp: Utc::now(),
},
);
ctx.db
.mutate(|db| {
if let Some(progress) = db
.as_public_mut()
.as_server_info_mut()
.as_status_info_mut()
.as_backup_progress_mut()
.transpose_mut()
{
progress.insert(&id, &BackupProgress { complete: true })?;
}
Ok(())
})
.await
.result?;
}
backup_report.insert(
id.clone(),

View File

@@ -4,6 +4,7 @@ use futures::future::BoxFuture;
use futures::{FutureExt, TryFutureExt};
use rpc_toolkit::yajrc::RpcError;
use crate::db::model::public::BackupProgress;
use crate::disk::mount::filesystem::ReadWrite;
use crate::prelude::*;
use crate::rpc_continuations::Guid;
@@ -29,6 +30,7 @@ impl ServiceActorSeed {
ErrorKind::Cancelled,
))
};
let backup_succeeded = res.is_ok();
let id = &self.id;
self.ctx
.db
@@ -49,7 +51,19 @@ impl ServiceActorSeed {
} => DesiredStatus::Stopped,
x => x,
})
})
})?;
if backup_succeeded {
if let Some(progress) = db
.as_public_mut()
.as_server_info_mut()
.as_status_info_mut()
.as_backup_progress_mut()
.transpose_mut()
{
progress.insert(id, &BackupProgress { complete: true })?;
}
}
Ok(())
})
.await
.result?;