From fe598a7a60b4b888a30b341c62abb01669af89e2 Mon Sep 17 00:00:00 2001 From: wiiznokes <78230769+wiiznokes@users.noreply.github.com> Date: Mon, 9 Sep 2024 21:37:25 +0200 Subject: [PATCH] fix(audio): fix high CPU usage --- cosmic-applet-audio/src/pulse.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cosmic-applet-audio/src/pulse.rs b/cosmic-applet-audio/src/pulse.rs index dce58852..8c724cb2 100644 --- a/cosmic-applet-audio/src/pulse.rs +++ b/cosmic-applet-audio/src/pulse.rs @@ -219,6 +219,10 @@ impl PulseHandle { loop { // This is where the we match messages from the GUI to pass to the pulse server let mut msgs = Vec::new(); + + if let Some(msg) = to_pulse_recv.recv().await { + msgs.push(msg); + } while let Ok(msg) = to_pulse_recv.try_recv() { msgs.push(msg); }