From 28c3c7c4563102e83d9f9fce04c7993f8ed3cdf9 Mon Sep 17 00:00:00 2001 From: Ashley Wulber Date: Wed, 19 Mar 2025 10:56:50 -0400 Subject: [PATCH] fix(bluetooth): await sleep --- cosmic-applet-bluetooth/src/bluetooth.rs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/cosmic-applet-bluetooth/src/bluetooth.rs b/cosmic-applet-bluetooth/src/bluetooth.rs index 41a1b9f1..820ab822 100644 --- a/cosmic-applet-bluetooth/src/bluetooth.rs +++ b/cosmic-applet-bluetooth/src/bluetooth.rs @@ -82,7 +82,9 @@ async fn start_listening( Err(_) => { _ = tokio::time::sleep(Duration::from_millis( 2_u64.saturating_pow(retry_count), - )); + )) + .await; + return State::Ready(retry_count.saturating_add(1)); } }; @@ -92,7 +94,8 @@ async fn start_listening( Err(_) => { _ = tokio::time::sleep(Duration::from_millis( 2_u64.saturating_pow(retry_count), - )); + )) + .await; return State::Ready(retry_count.saturating_add(1)); } }; @@ -551,7 +554,7 @@ impl BluerSessionState { let _handle: JoinHandle> = spawn(async move { let mut status = adapter_clone.is_powered().await.unwrap_or_default(); loop { - tokio::time::sleep(Duration::from_secs(5)).await; + _ = tokio::time::sleep(Duration::from_secs(5)).await; let new_status = adapter_clone.is_powered().await.unwrap_or_default(); if new_status != status { status = new_status;