From f15fdaefbcfe5cde3b0289c1e106cb85f6d3d39b Mon Sep 17 00:00:00 2001 From: QuantumEntangledAndy Date: Sun, 4 Aug 2024 13:04:23 +0700 Subject: [PATCH] Don't sleep the thread in async --- crates/core/src/bc_protocol/talk.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/crates/core/src/bc_protocol/talk.rs b/crates/core/src/bc_protocol/talk.rs index de0cb0a..df42e86 100644 --- a/crates/core/src/bc_protocol/talk.rs +++ b/crates/core/src/bc_protocol/talk.rs @@ -410,7 +410,8 @@ impl BcCamera { // Chunks are still being played, while talk_stop will interrupt them. Wait until we expect // the stream to end (+ and extra 100ms) before issuing talk_stop. let remaining_stream_duration = expected_stream_end - std::time::Instant::now(); - std::thread::sleep(remaining_stream_duration + std::time::Duration::from_secs_f32(0.1)); + tokio::time::sleep(remaining_stream_duration + std::time::Duration::from_secs_f32(0.1)) + .await; self.talk_stop().await?;