Fix race condition issues with provided dynamic configuration

* tests: add tests to show race condition on provider config

* fix: store a deep copy of previous provider config

* fix: send a deep copy of provdier config to watcher listener
This commit is contained in:
Kevin Pollet 2020-07-02 11:18:04 +02:00 committed by GitHub
parent 607cda779d
commit 4d71f682b3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 95 additions and 2 deletions

View file

@ -224,8 +224,8 @@ func (c *ConfigurationWatcher) throttleProviderConfigReload(ctx context.Context,
logger.Info("Skipping same configuration")
continue
}
previousConfig = nextConfig
ring.In() <- nextConfig
previousConfig = *nextConfig.DeepCopy()
ring.In() <- *nextConfig.DeepCopy()
}
}
}