Add afk or not-afk status key/value to aw-watcher-window - #82
Open
guillaumezin wants to merge 3 commits into
Open
guillaumezin wants to merge 3 commits into
guillaumezin wants to merge 3 commits into
Conversation
run_iteration failures run_first_supported's loop caught every error from run_iteration (including timeouts) and just logged it, then kept looping forever on the same broken state. In particular, once a Wayland idle watcher's event queue socket dies (e.g. "Broken pipe" after the KWin compositor restarts, crashes, or a suspend/resume cycle invalidates the connection), there is no reconnection logic anywhere — every subsequent iteration fails identically, indefinitely, without the process ever exiting or self-healing. Since main.rs races the idle and active-window watcher tasks with tokio::select! and exits the whole process as soon as either task completes, we can use that as the recovery mechanism: after too many consecutive failures, give up on the current watcher instance and return, which ends the process. An external supervisor (systemd, launch script) is expected to restart it, establishing a fresh connection to the compositor/X server from scratch. Changes: - Track consecutive_failures across loop iterations, reset to 0 on success. - After MAX_CONSECUTIVE_FAILURES (10, i.e. ~50s at the default 5s idle poll interval) consecutive errors or timeouts, log a final message and return, ending run_first_supported's loop. Applies uniformly to both WatcherType::Idle and WatcherType::ActiveWindow since they share this loop. This complements (does not replace) the staleness-based afk fallback in report_client.rs: that fallback keeps status reporting safe while the watcher is stuck and during the brief restart window, while this change actually restores idle detection instead of leaving it permanently stuck after a broken connection.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is really helpful to watch/filter buckets data with Grafana