-
Notifications
You must be signed in to change notification settings - Fork 380
Overhaul recap handling #740
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
Merged
Merged
+1,071
−840
Conversation
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
The logic does not use the persisted values so they do not need to be persisted.
Currently the semantics of recap variables are that values are updated in `%config` and propagate to `%recap`. Before this commit, `warned-min-interval` and `warned-min-error-interval` were set in `%recap` instead of `%config`, meaning if they followed the semantics they would be overwritten or deleted when synced with `%config`. Now the values are set in `%config` to match the behavior of other recap variables.
This should have been part of commit de5d894 but I forgot.
There's no need to pass a reference to `%recap` as an argument when that is the only way `read_recap` is ever used.
Before, if a non-`undef` value was in `%recap` and the corresponding value in `%config` became `undef`, the `%recap` value would remain untouched. Now it is deleted to match `%config`. Also, any `%recap` values without a corresponding recap variable declaration are deleted.
These just add cold code paths and impair readability and maintainability.
This consolidates the legacy support with other legacy support logic, which will make it easier to refactor in a future commit.
for readability (the logic that uses the `update` boolean should be responsible for clearing it).
This simplifies the logic a bit and improves readability.
This helps keep `%config` "clean", which helps with testing and debugging.
for readability
This is a step toward improving readability of `%config`/`%recap` synchronization.
This is a step toward separating `%recap` from `%config`.
This is a step toward separating `%recap` from `%config`.
Status is not configuration so it doesn't belong in `%config`. `wantip`, `wantipv4`, and `wantipv6` are still passed along in `%config` because `group_hosts_by` needs access to them like other settings.
This improves readability and will make it easier to refactor to fix issues or add features.
This is a preparatory step for separating recap variables from config variables.
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 fixes numerous bugs due to corner cases (and a few not-so-corner cases) in the loading and saving of the cache file (recap). This should reduce load on services (fewer unnecessary update attempts) and generally improves the code's health to make it easier to add new features or refactor to fix other bugs.