Skip to content

Conversation

@darth-raijin
Copy link
Contributor

@darth-raijin darth-raijin commented Nov 2, 2025

Changes:

  • Add unit tests to EurekaReactiveDiscoveryClientTests.
  • Add new EurekaDiscoveryClientTests focused on the default implementation for the probe() method.

See #4157 (comment)

}

@Override
public void probe() {
Copy link
Contributor

Choose a reason for hiding this comment

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

The default implementation already calls getServices() which calls this.eurekaClient.getApplications() so how is this doing anything different?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hey Ryan, thanks for reviewing :)

As per the Discovery client interface, where the probe() function is defined, the Javadocs mention there’s an intention for it to be a lightweight probe to ensure connectivity.

The major difference here is that calling this.eurekaClient.getApplications() directly avoids the overhead from getServices(), which iterates over all registered applications, allocates new lists, and lowercases each name. The goal was to keep probe() minimal and avoid unnecessary allocations when we don’t need the data being returned.

Do you prefer keeping it to getServices()?

Copy link
Contributor

Choose a reason for hiding this comment

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

Agree getServices() does do some additional work, but most of the overhead is incurred by the network request of the getApplications() call itself so I dont see this saving a ton of overhead unless you had a very large number of instances.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That makes sense, this might be a premature/uneeded optimization. I am fine with reverting the override, and keeping the default implementation.

What do you think would be a fitting way to move forward?

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think we need to do anything because it should already be using the default implementation

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The override is now reverted as discussed

Copy link
Contributor

Choose a reason for hiding this comment

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

I guess I dont understand why we need to make any changes in spring-cloud-netflix if the default implementations in spring-cloud-commons is acceptable

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Apologies, I seem to have misunderstood the intention :)
Do you think the tests would still add any value, or should I go ahead and close the PR? Thanks again for taking the time to review it!

Copy link
Contributor

Choose a reason for hiding this comment

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

The tests are fine but the reactive implementation is still overriding the default implementation

Signed-off-by: Mohamed Macow <mmacovv@gmail.com>
Signed-off-by: Mohamed Macow <mmacovv@gmail.com>
Signed-off-by: Mohamed Macow <mmacovv@gmail.com>
Signed-off-by: Mohamed Macow <mmacovv@gmail.com>
@darth-raijin darth-raijin changed the title Implement probe() in EurekaDiscoveryClient and reactiveProbe() in EurekaReactiveDiscoveryClient Implement reactiveProbe() in EurekaReactiveDiscoveryClient Nov 10, 2025
Signed-off-by: Mohamed Macow <mmacovv@gmail.com>
Signed-off-by: Mohamed Macow <mmacovv@gmail.com>
@darth-raijin darth-raijin changed the title Implement reactiveProbe() in EurekaReactiveDiscoveryClient Implement tests for EurekaReactiveDiscoveryClient and EurekaDiscoveryClientTests Nov 10, 2025
@ryanjbaxter ryanjbaxter added this to the 5.0.0-RC1 milestone Nov 10, 2025
@ryanjbaxter ryanjbaxter merged commit 9be3229 into spring-cloud:main Nov 10, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

No open projects
Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants