Page MenuHomePhorge

D14095.1768851135.diff
No OneTemporary

Size
890 B
Referenced Files
None
Subscribers
None

D14095.1768851135.diff

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<dyn Error>> {
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(())
}

File Metadata

Mime Type
text/plain
Expires
Mon, Jan 19, 7:32 PM (3 h, 15 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5957862
Default Alt Text
D14095.1768851135.diff (890 B)

Event Timeline