Skip to content

[Maven] Fix some malformed memoizations#5132

Merged
brrygrdn merged 2 commits intomainfrom
brrygrdn/maven-memoization-cleanup
May 13, 2022
Merged

[Maven] Fix some malformed memoizations#5132
brrygrdn merged 2 commits intomainfrom
brrygrdn/maven-memoization-cleanup

Conversation

@brrygrdn
Copy link
Copy Markdown
Contributor

This PR collects up a pass on any methods that make Excon.get calls which attempt to memoize the outcome of requests.

I found a couple of cases where the pattern used wouldn't correctly memoize falsy values and fall through to making the request a second time.

From walking through the code I don't think these will have any performance implications unfortunately, I don't believe these methods are called more than once in any of our runtimes, but it could catch us out in future.

@brrygrdn brrygrdn added the L: java:maven Maven packages via Maven label May 11, 2022
@brrygrdn brrygrdn requested a review from a team as a code owner May 11, 2022 21:00
Comment on lines 157 to 158
Copy link
Copy Markdown
Contributor Author

@brrygrdn brrygrdn May 11, 2022

Choose a reason for hiding this comment

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

This memoization pattern works, but I found it hard to read so this is an opinionated change just to improve the readability.

It does make it a little easier to maintain in the event that the fetch_dependency_metadata code was ever to return a falsy value rather than a blank string.

@brrygrdn brrygrdn force-pushed the brrygrdn/maven-memoization-cleanup branch from 8f2dd73 to 3a53e44 Compare May 13, 2022 10:44
@brrygrdn brrygrdn enabled auto-merge May 13, 2022 10:51
@brrygrdn brrygrdn merged commit 29e3f41 into main May 13, 2022
@brrygrdn brrygrdn deleted the brrygrdn/maven-memoization-cleanup branch May 13, 2022 11:16
@brrygrdn brrygrdn mentioned this pull request May 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

L: java:maven Maven packages via Maven

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants