Skip to content

Commit 3326f43

Browse files
alex-ds13LGUG2Z
authored andcommitted
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.
1 parent 53a83ee commit 3326f43

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

komorebi-bar/src/main.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -351,6 +351,10 @@ fn main() -> color_eyre::Result<()> {
351351
for client in listener.incoming() {
352352
match client {
353353
Ok(subscription) => {
354+
match subscription.set_read_timeout(Some(Duration::from_secs(1))) {
355+
Ok(()) => {}
356+
Err(error) => tracing::error!("{}", error),
357+
}
354358
let mut buffer = Vec::new();
355359
let mut reader = BufReader::new(subscription);
356360

0 commit comments

Comments
 (0)