From f60a1a9ed080db90e7deef521c8a51fb2e8796c4 Mon Sep 17 00:00:00 2001 From: Aiden McClelland Date: Mon, 23 Mar 2026 01:15:54 -0600 Subject: [PATCH] fix: set backup progress complete atomically with status revert MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- core/src/backup/backup_bulk.rs | 16 ---------------- core/src/service/transition/backup.rs | 16 +++++++++++++++- 2 files changed, 15 insertions(+), 17 deletions(-) diff --git a/core/src/backup/backup_bulk.rs b/core/src/backup/backup_bulk.rs index 79584c669..9e020240d 100644 --- a/core/src/backup/backup_bulk.rs +++ b/core/src/backup/backup_bulk.rs @@ -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(), diff --git a/core/src/service/transition/backup.rs b/core/src/service/transition/backup.rs index 089d9f127..39e1a13e4 100644 --- a/core/src/service/transition/backup.rs +++ b/core/src/service/transition/backup.rs @@ -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?;