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

fix(spring): limit retry settings configuration by method type #1212

Merged
merged 3 commits into from
Jan 10, 2023

Conversation

emmileaf
Copy link
Contributor

@emmileaf emmileaf commented Jan 4, 2023

This PR is a patch for the RetrySettings configuration issue discovered in GoogleCloudPlatform/spring-cloud-gcp#1407 (comment). It excludes streaming and LRO methods from retry configuration through spring properties for now.

@emmileaf emmileaf added the spring pr that's related to spring code gen, intend to merge into autoconfig-gen-draft2 branch. label Jan 4, 2023
@emmileaf emmileaf changed the title fix(spring): remove retry settings configuration for streaming methods fix(spring): limit retry settings configuration by method type Jan 5, 2023
@emmileaf emmileaf marked this pull request as ready for review January 5, 2023 16:53
@emmileaf emmileaf requested a review from a team as a code owner January 5, 2023 16:53
@@ -659,10 +659,13 @@ private static MethodDefinition createSettingsBeanMethod(
List<Statement> updateRetrySettingsStatementBody = new ArrayList<>();

for (Method method : service.methods()) {
List<Statement> updateMethodWithServiceRetryStatments =
if (!method.stream().equals(Method.Stream.NONE) || method.hasLro()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think it would make sense to filter the methods in the foreach declaration (e.g. for (Method method : Utils.getFilteredMethods(service.methods)) to centralize/dereplicate the filtering logic (could also be done by adding a convenience method in Service but may be overkill)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Makes sense, given we expect this to be changed in the future. Updated and moved this logic to utils.

@sonarqubecloud
Copy link

sonarqubecloud bot commented Jan 6, 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

100.0% 100.0% Coverage
0.0% 0.0% Duplication

Copy link
Contributor

@diegomarquezp diegomarquezp left a comment

Choose a reason for hiding this comment

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

LGTM!

public static List<Method> getMethodsForRetryConfiguration(Service service) {
// Returns list of methods with retry configuration support
// This currently excludes streaming and LRO methods
return service.methods().stream()
Copy link
Collaborator

Choose a reason for hiding this comment

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

Just a note that we need to revisit this logic before GA, as we discussed, BIDI and Client streaming do not support retry, but Server streaming and LRO should support it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Noted - thank you!

@emmileaf emmileaf merged commit bfef416 into autoconfig-gen-draft2 Jan 10, 2023
@emmileaf emmileaf deleted the spring-retry-patch branch January 10, 2023 17:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
spring pr that's related to spring code gen, intend to merge into autoconfig-gen-draft2 branch.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants