π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Use FRB helper for blocking ML work
laurenspriem1fff7cf1c647
diff --git a/rust/Cargo.lock b/rust/Cargo.lockindex 59e37a7b4d..e6dd98da36 100644--- a/rust/Cargo.lock+++ b/rust/Cargo.lock@@ -2938,7 +2938,6 @@ dependencies = ["ente-vecdb","flutter_rust_bridge","log",- "tokio",][[package]]diff --git a/rust/bindings/frb/photos/Cargo.toml b/rust/bindings/frb/photos/Cargo.tomlindex 7af52a8924..ac1b6f50cb 100644--- a/rust/bindings/frb/photos/Cargo.toml+++ b/rust/bindings/frb/photos/Cargo.toml@@ -18,7 +18,6 @@ ente-photos.workspace = trueente-vecdb.workspace = trueflutter_rust_bridge.workspace = truelog.workspace = true-tokio = { workspace = true, features = ["rt"] }[lints]workspace = truediff --git a/rust/bindings/frb/photos/src/api/ml_indexing_api.rs b/rust/bindings/frb/photos/src/api/ml_indexing_api.rsindex 4d27bbc379..5356c8cb48 100644--- a/rust/bindings/frb/photos/src/api/ml_indexing_api.rs+++ b/rust/bindings/frb/photos/src/api/ml_indexing_api.rs@@ -2,6 +2,7 @@ use std::path::Path;use ente_assets::AssetStore;use ente_ml::{assets, error::MlError, indexing, types};+use flutter_rust_bridge::spawn_blocking_with;#[cfg(any(feature = "flutter", frb_expand))]use crate::frb_generated::StreamSink;@@ -144,7 +145,7 @@ pub async fn init_ml_runtime(run_pets,).await?;- tokio::task::spawn_blocking(move || indexing::init_ml_runtime(paths))+ spawn_blocking_with(move || indexing::init_ml_runtime(paths), ()).await.map_err(task_error)}@@ -175,7 +176,7 @@ pub async fn analyze_image_rust(model_paths,};- tokio::task::spawn_blocking(move || indexing::analyze_image(shared_req))+ spawn_blocking_with(move || indexing::analyze_image(shared_req), ()).await.map_err(task_error)?.map(to_api_analyze_image_result)@@ -191,7 +192,7 @@ pub async fn run_clip_text_rust(req: RunClipTextRequest) -> Result<RunClipTextRevocab_path: paths.vocab.to_string_lossy().into_owned(),};- tokio::task::spawn_blocking(move || indexing::run_clip_text(shared_req))+ spawn_blocking_with(move || indexing::run_clip_text(shared_req), ()).await.map_err(task_error)?.map(|result| RunClipTextResult {@@ -266,7 +267,7 @@ pub fn remove_indexing_models(assets_dir: String) -> Result<(), String> {assets::remove_mobile_indexing_models(&AssetStore::new(&assets_dir), Path::new(&assets_dir))}-fn task_error(error: tokio::task::JoinError) -> RustMlError {+fn task_error(error: impl std::fmt::Display) -> RustMlError {RustMlError::Other {message: error.to_string(),}