fix discovery weight param not set to register request bug

pull/104/head
lepdou 2 years ago
parent ce20863792
commit 17313ed78d

@ -1,19 +1,5 @@
# Change Log # Change Log
--- ---
- [the server address only support one ip](https://github.com/Tencent/spring-cloud-tencent/pull/36) - [feat:fix discovery weight param not set to register request bug](https://github.com/Tencent/spring-cloud-tencent/pull/104)
- [feature: get service list by given namespace](https://github.com/Tencent/spring-cloud-tencent/pull/38)
- [feat:Support multi-discovery server.](https://github.com/Tencent/spring-cloud-tencent/pull/42)
- [fix:fix [Deserialization of Untrusted Data in logback]](https://github.com/Tencent/spring-cloud-tencent/pull/44/files)
- [feat:support customize registered ip address.](https://github.com/Tencent/spring-cloud-tencent/pull/47)
- [fix:fix import default log implement error](https://github.com/Tencent/spring-cloud-tencent/pull/53)
- [send heartbeat if healthcheck url not configured](https://github.com/Tencent/spring-cloud-tencent/pull/54)
- [feat:optimize project structure and checkstyle](https://github.com/Tencent/spring-cloud-tencent/pull/56)
- [feat:divide storage and transfer of metadata.](https://github.com/Tencent/spring-cloud-tencent/pull/63)
- [feat:support polaris config center.](https://github.com/Tencent/spring-cloud-tencent/pull/69)
- [feat:optimize metadata module.](https://github.com/Tencent/spring-cloud-tencent/pull/70)
- [feat: optimize pom dependency and demo](https://github.com/Tencent/spring-cloud-tencent/pull/71)
- [feat:upgrade polaris version to 1.3.0.](https://github.com/Tencent/spring-cloud-tencent/pull/72)
- [feat:rollback init polaris-context to application phase](https://github.com/Tencent/spring-cloud-tencent/pull/73)
- [fix:fix junit not working bug.](https://github.com/Tencent/spring-cloud-tencent/pull/96)

@ -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.
@ -131,11 +131,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;
} }

@ -92,6 +92,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