Skip to content

fix: avoid computing potentially unused values #1759

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

Merged
merged 1 commit into from
Feb 9, 2023
Merged

fix: avoid computing potentially unused values #1759

merged 1 commit into from
Feb 9, 2023

Conversation

metacosm
Copy link
Collaborator

@metacosm metacosm commented Feb 6, 2023

Fixes #1758

@metacosm metacosm self-assigned this Feb 6, 2023
@metacosm metacosm requested a review from csviri February 6, 2023 21:16
@@ -66,7 +66,7 @@ protected ReconcileResult<R> reconcile(P primary, R actualResource, Context<P> c
if (updatable) {
final Matcher.Result<R> match = match(actualResource, primary, context);
if (!match.matched()) {
final var desired = match.computedDesired().orElse(desired(primary, context));
final var desired = match.computedDesired().orElseGet(() -> desired(primary, context));
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is the salient part of the fix. I also took the opportunity to fix similar issues and low hanging fruits.

Copy link
Collaborator

@csviri csviri left a comment

Choose a reason for hiding this comment

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

LGTM

@sonarqubecloud
Copy link

sonarqubecloud bot commented Feb 7, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

50.0% 50.0% Coverage
0.0% 0.0% Duplication

@metacosm metacosm merged commit 5d8c567 into main Feb 9, 2023
@metacosm metacosm deleted the fix-1758 branch February 9, 2023 15:23
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.

Dependent resource desired() is called twice during reconcile for update
2 participants