Skip to content

Use lb scheme to find the baseUrls for load-balancing. #1492

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
May 19, 2025

Conversation

OlgaMaciaszek
Copy link
Collaborator

No description provided.

Signed-off-by: Olga Maciaszek-Sharma <olga.maciaszek-sharma@broadcom.com>
@OlgaMaciaszek OlgaMaciaszek added this to the 5.0.0-M1 milestone May 19, 2025
@OlgaMaciaszek OlgaMaciaszek self-assigned this May 19, 2025
@OlgaMaciaszek OlgaMaciaszek marked this pull request as ready for review May 19, 2025 10:21
@@ -71,12 +72,16 @@ public void configureGroups(@NonNull Groups<RestClient.Builder> groups) {
groups.configureClient((group, builder) -> {
String groupName = group.name();
HttpClientServiceProperties.Group groupProperties = clientServiceProperties.getGroup().get(groupName);
if (groupProperties == null || groupProperties.getBaseUrl() == null) {
String baseUrlString = groupProperties == null ? null : groupProperties.getBaseUrl();
URI existingBaseUrl = baseUrlString == null ? null : URI.create(baseUrlString);
Copy link
Contributor

Choose a reason for hiding this comment

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

Seems like some of this logic could be simplified if you checked if baseUrlString == null

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Wanted to have a local variable to be able to use it later in the else if section: else if ("lb".equalsIgnoreCase(existingBaseUrl.getScheme()))

Copy link
Contributor

Choose a reason for hiding this comment

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

Actually I think what would make this clearer would be to just simplify this to URI existingBaseUrl = groupProperties == null ? null : URI.create(groupProperties.getBaseUrl());

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

groupProperties.getBaseUrl() can also be null.

@OlgaMaciaszek OlgaMaciaszek merged commit 1658768 into 5.0.x May 19, 2025
1 check passed
@OlgaMaciaszek OlgaMaciaszek deleted the load-balance-by-scheme branch July 25, 2025 10:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants