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

remotecfg: fix logic around skipping loaded configuration #2762

Merged
merged 2 commits into from
Feb 19, 2025

Conversation

tpaschalis
Copy link
Member

@tpaschalis tpaschalis commented Feb 19, 2025

PR Description

This PR:

  1. Renames currentConfigHash to lastLoadedConfigHash.
  2. Makes sure we always set its value in parseAndLoad, before we attempt to pass it the configuration to the controller, and nowhere else
  3. Skip over applying configurations that are the same as the previously applied ones.
  4. Adds a test
  5. Renames get/set helpers to mirror the new name

The other thing to do would be to remove this logic entirely and only depend on the server's response as to whether we should skip applying configurations or not.

Given this is likely a breaking change, this is our chance to choose what to do here before removing the private-preview label from the next release. Thoughts?

Which issue(s) this PR fixes

No issue filed.

Notes to the Reviewer

PR Checklist

  • CHANGELOG.md updated
  • Documentation added
  • Tests updated
  • Config converters updated

Copy link
Contributor

@thampiotr thampiotr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

only one nit

Signed-off-by: Paschalis Tsilias <[email protected]>
@@ -480,22 +479,21 @@ func (s *Service) parseAndLoad(b []byte) error {
if len(b) == 0 {
return nil
}

s.setLastLoadedCfgHash(getHash(b))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it possible to get a length 0 config and get stuck doing:

good config -> 0 length config -> good config

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

answered myself: we will never set the 0 length config into the hash OR attempt to load it. looks good!

Copy link
Contributor

@spartan0x117 spartan0x117 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@tpaschalis tpaschalis marked this pull request as ready for review February 19, 2025 15:11
@tpaschalis tpaschalis requested a review from a team as a code owner February 19, 2025 15:11
@tpaschalis tpaschalis merged commit 93b71b6 into main Feb 19, 2025
30 checks passed
@tpaschalis tpaschalis deleted the fix-bad-config branch February 19, 2025 15:12
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.

4 participants