Merge pull request #162 from SkyeBeFreeman/main

fix:Turn off automatic injection of Polars rule.
pull/164/head
Haotian Zhang 3 years ago committed by GitHub
commit d505eb9669
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1,4 +1,5 @@
# Change Log
---
- [fix:fix routes of gateway doesn't refresh bug.](https://github.com/Tencent/spring-cloud-tencent/pull/158)
- [fix:fix routes of gateway doesn't refresh bug.](https://github.com/Tencent/spring-cloud-tencent/pull/158)
- [fix:Turn off automatic injection of Polars rule.](https://github.com/Tencent/spring-cloud-tencent/pull/152)

@ -34,14 +34,13 @@ import com.tencent.polaris.api.rpc.InstanceHeartbeatRequest;
import com.tencent.polaris.api.rpc.InstanceRegisterRequest;
import com.tencent.polaris.api.rpc.InstancesResponse;
import com.tencent.polaris.client.util.NamedThreadFactory;
import org.apache.logging.log4j.util.Strings;
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.cloud.client.serviceregistry.Registration;
import org.springframework.cloud.client.serviceregistry.ServiceRegistry;
import org.springframework.util.StringUtils;
import static org.springframework.util.ReflectionUtils.rethrowRuntimeException;
@ -207,7 +206,7 @@ public class PolarisServiceRegistry implements ServiceRegistry<Registration> {
// first.
// If the health check passes, the heartbeat will be reported.
// If it does not pass, the heartbeat will not be reported.
if (Strings.isNotEmpty(healthCheckEndpoint)) {
if (!StringUtils.isNotBlank(healthCheckEndpoint)) {
if (!healthCheckEndpoint.startsWith("/")) {
healthCheckEndpoint = "/" + healthCheckEndpoint;
}

@ -24,8 +24,6 @@ import com.netflix.loadbalancer.IRule;
import com.netflix.loadbalancer.Server;
import com.netflix.loadbalancer.ServerList;
import com.tencent.cloud.polaris.loadbalancer.PolarisLoadBalancer;
import com.tencent.cloud.polaris.loadbalancer.rule.PolarisLoadBalanceRule;
import com.tencent.cloud.polaris.loadbalancer.rule.PolarisWeightedRandomRule;
import com.tencent.polaris.api.core.ConsumerAPI;
import com.tencent.polaris.router.api.core.RouterAPI;
@ -41,17 +39,17 @@ import org.springframework.context.annotation.Configuration;
@Configuration
public class PolarisRibbonClientConfiguration {
@Bean
@ConditionalOnMissingBean
public IRule polarisRibbonRule(
PolarisLoadBalancerProperties polarisLoadBalancerProperties) {
switch (PolarisLoadBalanceRule
.fromStrategy(polarisLoadBalancerProperties.getStrategy())) {
case WEIGHTED_RANDOM_RULE:
default:
return new PolarisWeightedRandomRule();
}
}
// @Bean
// @ConditionalOnMissingBean
// public IRule polarisRibbonRule(
// PolarisLoadBalancerProperties polarisLoadBalancerProperties) {
// switch (PolarisLoadBalanceRule
// .fromStrategy(polarisLoadBalancerProperties.getStrategy())) {
// case WEIGHTED_RANDOM_RULE:
// default:
// return new PolarisWeightedRandomRule();
// }
// }
@Bean
@ConditionalOnMissingBean

Loading…
Cancel
Save