Aias00 commented on code in PR #6274:
URL: https://github.com/apache/shenyu/pull/6274#discussion_r2731034474
##########
shenyu-loadbalancer/src/main/java/org/apache/shenyu/loadbalancer/cache/UpstreamCacheManager.java:
##########
@@ -146,53 +147,106 @@ public void removeByKey(final String key) {
*/
public void submit(final String selectorId, final List<Upstream>
upstreamList) {
List<Upstream> actualUpstreamList = Objects.isNull(upstreamList) ?
Lists.newArrayList() : upstreamList;
- actualUpstreamList.forEach(upstream -> {
- if (!upstream.isHealthCheckEnabled()) {
- upstream.setStatus(true);
- upstream.setHealthy(true);
- }
- });
+ initializeUpstreamHealthStatus(actualUpstreamList);
Review Comment:
The `initializeUpstreamHealthStatus` method is called before partitioning
the upstreams. This might lead to unnecessary processing if the list is empty.
Consider moving this call after checking if the list is empty to avoid
unnecessary processing.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]