Skip to content

Conversation

@rhansen
Copy link
Member

@rhansen rhansen commented Sep 2, 2024

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.

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.
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`.
@rhansen rhansen merged commit a7abfcb into ddclient:master Sep 2, 2024
@rhansen rhansen deleted the recap branch September 2, 2024 07:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant