From 545bd99121b5315f596bbb803cbbeb8d57bb700e Mon Sep 17 00:00:00 2001 From: Sven Erik Jeroschewski Date: Fri, 18 Oct 2024 11:40:58 +0200 Subject: [PATCH] decreases the part for when the kuksa client is locked in the zenoh-kuksa-provider --- zenoh-kuksa-provider/Cargo.toml | 2 ++ zenoh-kuksa-provider/src/main.rs | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/zenoh-kuksa-provider/Cargo.toml b/zenoh-kuksa-provider/Cargo.toml index 6be94b1..c75adff 100644 --- a/zenoh-kuksa-provider/Cargo.toml +++ b/zenoh-kuksa-provider/Cargo.toml @@ -12,6 +12,8 @@ ######################################################################## +[workspace] + [package] name = "zenoh-kuksa-provider" version = "0.1.0" diff --git a/zenoh-kuksa-provider/src/main.rs b/zenoh-kuksa-provider/src/main.rs index 84fcc67..4f31248 100644 --- a/zenoh-kuksa-provider/src/main.rs +++ b/zenoh-kuksa-provider/src/main.rs @@ -55,8 +55,6 @@ async fn handling_zenoh_subscribtion( ) { info!("Listening on selector: {:?}", provider_config.zenoh.key_exp); - let mut sub_client = kuksa_client.lock().await; - let provider_config_clone = Arc::clone(&provider_config); let subscriber = session .declare_subscriber(provider_config_clone.zenoh.key_exp.clone()) @@ -79,11 +77,13 @@ async fn handling_zenoh_subscribtion( if field_type == "currentValue" { let datapoint_update = new_datapoint_for_update(&vss_path, &sample, &store); + let mut sub_client = kuksa_client.lock().await; debug!("Forwarding: {:#?}", datapoint_update); sub_client .set_current_values(datapoint_update) .await .unwrap(); + drop(sub_client); } } }