diff --git a/native/native_rust_library/src/backup/upload_handler.rs b/native/native_rust_library/src/backup/upload_handler.rs --- a/native/native_rust_library/src/backup/upload_handler.rs +++ b/native/native_rust_library/src/backup/upload_handler.rs @@ -40,14 +40,16 @@ pub fn start_backup_handler() -> Result<(), Box> { let mut handle = UPLOAD_HANDLER.lock()?; - match handle.take() { - // Don't start backup handler if it's already running - Some(handle) if !handle.is_finished() => (), - _ => { - *handle = Some(RUNTIME.spawn(super::start()?)); + + if let Some(handle) = &*handle { + if !handle.is_finished() { + return Ok(()); // Early exit if a running future is detected } } + // No running future or the existing one is finished + *handle = Some(RUNTIME.spawn(super::start()?)); + Ok(()) }