Skip to content

Commit

Permalink
fix(bar): prevent komorebi connection from staling
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
alex-ds13 authored and LGUG2Z committed Dec 26, 2024
1 parent 53a83ee commit 4babf33
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions komorebi-bar/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit 4babf33

Please sign in to comment.