fix: Ensure proper sequencing during initialization #1232
Merged
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.
Details
Fix canary upgrade problem by ensuring that ordering assumptions are respected during initialization. For the autoupdate to work as expected, it's important that
Container.SetAutoUpdateReleaseChannel
gets called beforeContainer.GetDefaultInstance
. When #1204 was added, the code is in the proper sequence, and the upgrade works as expected when built for the debug config. When built for the release config, though, I was able to prove that the calls were occurring in the wrong order. It seems that the optimizer decided to change the sequence of calls between the API's, meaning that the autoUpdate code always loaded the production data.The change here is to move the telemetry initialization code into a separate method so the optimizer can no longer change the call order. As an aside, enabling telemetry in a method called
PopulateConfigurations
was a bit off, so having it in a separate method is also better coding style. I included a comment inPopulateConfigurations
as a reminder about the calling order dependency.Motivation
Address #1226
Context
Pull request checklist