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

Avoid configuring providers twice during preview #4004

Merged
merged 4 commits into from
Mar 1, 2020

Conversation

lukehoban
Copy link
Member

In the very common case where provider configuration does not change, during preview we were calling Configure on the cloud provider twice - once for the "old" configuration, and once for the "new" configuration.

This is not necessary, and we can just avoid using the new provider when configuration has not changed, since we will have configured the old provider very early so if we can use that we should.

Note that this technically doesn't prevent the second call to Configure from being made, but it prevents us from ever waiting on it. We may want to go further and avoid even calling Configure on the provider in this case.

Part of #3671.

In the very common case where provider configuration does not change, during preview we were calling `Configure` on the cloud provider twice - once for the "old" configuration, and once for the "new" configuration.

This is not necessary, and we can just avoid using the new provider when configuration has not changed, since we will have configured the old provider very early so if we can use that we should.

Note that this technically doesn't prevent the second call to `Configure` from being made, but it prevents us from ever waiting on it.  We may want to go further and avoid even calling `Configure` on the provider in this case.

Part of #3671.
Copy link
Member

@pgavlin pgavlin left a comment

Choose a reason for hiding this comment

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

The approach looks good; just a couple suggestions.

pkg/resource/deploy/providers/registry.go Outdated Show resolved Hide resolved
pkg/resource/deploy/providers/registry.go Outdated Show resolved Hide resolved
@lukehoban lukehoban merged commit 2067e27 into master Mar 1, 2020
@pulumi-bot pulumi-bot deleted the lukehoban/dont_confgure_twice_in_preview branch March 1, 2020 22:41
@lukehoban lukehoban mentioned this pull request Mar 2, 2020
5 tasks
lukehoban added a commit that referenced this pull request Mar 11, 2020
The changes in #4004 caused old provider configuration to be used even when a provider was different between inputs and outputs, in the case that the diff returned DiffUnkown.

To better handle that case, we compute a more accurate (but still conservative) DiffNone or DiffSome so that we can ensure we conservatively update to a new provider when needed, but retain the performance benefit of not creating and configuring a new provider as much as possible.

Part of pulumi/pulumi-aws#814.
lukehoban added a commit that referenced this pull request Mar 11, 2020
The changes in #4004 caused old provider configuration to be used even when a provider was different between inputs and outputs, in the case that the diff returned DiffUnkown.

To better handle that case, we compute a more accurate (but still conservative) DiffNone or DiffSome so that we can ensure we conservatively update to a new provider when needed, but retain the performance benefit of not creating and configuring a new provider as much as possible.

Part of pulumi/pulumi-aws#814.
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.

None yet

2 participants