Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

src/fs.{cc,h}: Update fs_stats without error spam. #2033

Merged
merged 2 commits into from
Sep 15, 2024

Conversation

pghvlaans
Copy link
Contributor

Checklist

◯ I have described the changes
◯ I have linked to any relevant GitHub issues, if applicable
Documentation in doc/ has been updated (N/A)
◯ All new code is licensed under GPLv3

Description

update_fs_stats was recently altered to clear set for all file systems every thirteen seconds, and its update_fs_stat call was removed. This was done to mitigate a longstanding issue whereby repeated errors appeared when updates were attempted for a nonexistent mountpoint. However, before the change, update_fs_stat was only called from prepare_fs_stat and update_fs_stats. In consequence, update_fs_stat is now called for each filesystem only at init time, and no changes are displayed.

Updating capabilities can be restored by reverting the change to update_fs_stats. In addition, repeated error messages can be suppressed in the following manner:

  1. Add a flag called errored and initialize to zero.
  2. If a mountpoint is not found, write an error only if errored is zero; once this has been done, set errored.
  3. Once the mountpoint has been found again, clear errored so that a new message can appear.
  • Describe how the changes will affect existing behaviour.

Filesystem information will be updated periodically as before. Nonexistent mountpoints now produce errors only once at init, and once more if an existing mountpoint is removed. That is, errors will no longer be produced at every update.

  • Describe how you tested and validated your changes.

I ran patched conky from a terminal to monitor standard error using a config file that included a spurious mountpoint. I periodically made and deleted that directory, verifying that error messages appeared only once upon deletion. This worked both with and without if_mounted. Live updates to fs_used and fs_free occurred as expected.

@github-actions github-actions bot added the sources PR modifies project sources label Sep 14, 2024
Copy link

netlify bot commented Sep 14, 2024

Deploy Preview for conkyweb canceled.

Name Link
🔨 Latest commit cf4f9af
🔍 Latest deploy log https://app.netlify.com/sites/conkyweb/deploys/66e51bbcbcd55d000870d15d

@brndnmtthws brndnmtthws added the bug Bug report or bug fix PR label Sep 14, 2024
@brndnmtthws brndnmtthws merged commit 7181477 into brndnmtthws:main Sep 15, 2024
39 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Bug report or bug fix PR sources PR modifies project sources
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants