Merge pull request #102 from lepdou/h/fix_weight_param

fix discovery weight param not set to register request bug
pull/110/head
Haotian Zhang 3 years ago committed by GitHub
commit 28cfcedcbd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -2,5 +2,5 @@
--- ---
- [Bugfix: fix router bug and add router example](https://github.com/Tencent/spring-cloud-tencent/pull/89) - [Bugfix: fix router bug and add router example](https://github.com/Tencent/spring-cloud-tencent/pull/89)
- [feat:fix discovery weight param not set to register request bug](https://github.com/Tencent/spring-cloud-tencent/pull/102)
- [Bugfix: fix causing cpu 100% when set ScheduledThreadPoolExecutor corePoolSize=0](https://github.com/Tencent/spring-cloud-tencent/pull/98) - [Bugfix: fix causing cpu 100% when set ScheduledThreadPoolExecutor corePoolSize=0](https://github.com/Tencent/spring-cloud-tencent/pull/98)

@ -56,7 +56,7 @@ public class PolarisDiscoveryProperties {
* Load balance weight. * Load balance weight.
*/ */
@Value("${spring.cloud.polaris.discovery.weight:#{100}}") @Value("${spring.cloud.polaris.discovery.weight:#{100}}")
private float weight; private int weight;
/** /**
* Version number. * Version number.
@ -134,11 +134,11 @@ public class PolarisDiscoveryProperties {
this.namespace = namespace; this.namespace = namespace;
} }
public float getWeight() { public int getWeight() {
return weight; return weight;
} }
public void setWeight(float weight) { public void setWeight(int weight) {
this.weight = weight; this.weight = weight;
} }

@ -93,6 +93,7 @@ public class PolarisServiceRegistry implements ServiceRegistry<Registration> {
instanceRegisterRequest.setService(registration.getServiceId()); instanceRegisterRequest.setService(registration.getServiceId());
instanceRegisterRequest.setHost(registration.getHost()); instanceRegisterRequest.setHost(registration.getHost());
instanceRegisterRequest.setPort(registration.getPort()); instanceRegisterRequest.setPort(registration.getPort());
instanceRegisterRequest.setWeight(polarisDiscoveryProperties.getWeight());
instanceRegisterRequest.setToken(polarisDiscoveryProperties.getToken()); instanceRegisterRequest.setToken(polarisDiscoveryProperties.getToken());
if (null != heartbeatExecutor) { if (null != heartbeatExecutor) {
instanceRegisterRequest.setTtl(ttl); instanceRegisterRequest.setTtl(ttl);

@ -50,7 +50,7 @@
}, },
{ {
"name": "spring.cloud.polaris.weight", "name": "spring.cloud.polaris.weight",
"type": "java.lang.String", "type": "java.lang.Integer",
"defaultValue": 100, "defaultValue": 100,
"description": "the weight of polaris instance , use to load-balance." "description": "the weight of polaris instance , use to load-balance."
} }

Loading…
Cancel
Save