Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F33322563
D14095.1768851135.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
890 B
Referenced Files
None
Subscribers
None
D14095.1768851135.diff
View Options
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
Details
Attached
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)
Attached To
Mode
D14095: [native_rust_library] make `start_backup_handler` thread-safe
Attached
Detach File
Event Timeline
Log In to Comment