From 82b5776ed36976b13bb73927931c6d0e985304ab Mon Sep 17 00:00:00 2001 From: alex-ds13 <145657253+alex-ds13@users.noreply.github.com> Date: Thu, 26 Dec 2024 10:52:00 +0000 Subject: [PATCH] fix(bar): prevent komorebi connection from staling Sometimes the bar would randomly stop receiving notifications from komorebi and would stop updating the `Komorebi` widget. This feels to me that the reason is the same one that used to happen on the `process_commands` from `komorebi` where the socket would get stuck reading an empty connection. This commit adds a read timeout to the socket to prevent that from happening and hopefully it should stop those situations where the bar would stop receiving notifications. --- komorebi-bar/src/main.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/komorebi-bar/src/main.rs b/komorebi-bar/src/main.rs index 759d6e59..173b1503 100644 --- a/komorebi-bar/src/main.rs +++ b/komorebi-bar/src/main.rs @@ -351,6 +351,10 @@ fn main() -> color_eyre::Result<()> { for client in listener.incoming() { match client { Ok(subscription) => { + match subscription.set_read_timeout(Some(Duration::from_secs(1))) { + Ok(()) => {} + Err(error) => tracing::error!("{}", error), + } let mut buffer = Vec::new(); let mut reader = BufReader::new(subscription);