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

fix(config): ignore first change notification in ListenForCustomConfi… #315

Merged
merged 1 commit into from
Mar 28, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions bootstrap/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,8 @@ func (cp *Processor) ListenForCustomConfigChanges(

configClient.WatchForChanges(updateStream, errorStream, configToWatch, sectionName)

isFirstUpdate := true

for {
select {
case <-cp.ctx.Done():
Expand All @@ -318,6 +320,14 @@ func (cp *Processor) ListenForCustomConfigChanges(
cp.lc.Error(ex.Error())

case raw := <-updateStream:
// Config Provider sends an update as soon as the watcher is connected even though there are not
// any changes to the configuration. This causes an issue during start-up if there is an
// envVars override of one of the Writable fields, so we must ignore the first update.
if isFirstUpdate {
isFirstUpdate = false
continue
}

cp.lc.Infof("Updated custom configuration '%s' has been received from the Configuration Provider", sectionName)
changedCallback(raw)
}
Expand Down