feat:support config all recover enabled. (#1605)

Co-authored-by: Haotian Zhang <skyebefreeman@qq.com>
pull/1609/head
Fishtail 3 months ago committed by GitHub
parent b55c8958a6
commit 3a728df6c8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -6,3 +6,4 @@
- [feat:upgrade to 2023.0.5.](https://github.com/Tencent/spring-cloud-tencent/pull/1588)
- [feat:support dynamic multi-discovery.](https://github.com/Tencent/spring-cloud-tencent/pull/1596)
- [feat:support ipv6.](https://github.com/Tencent/spring-cloud-tencent/pull/1601)
- [feat:support config all recover enabled.](https://github.com/Tencent/spring-cloud-tencent/pull/1605)

@ -42,6 +42,7 @@ public class DiscoveryConfigModifier implements PolarisConfigModifier {
RecoverRouterConfig recoverRouterConfig = configuration.getConsumer().getServiceRouter()
.getPluginConfig(ServiceRouterConfig.DEFAULT_ROUTER_RECOVER, RecoverRouterConfig.class);
recoverRouterConfig.setExcludeCircuitBreakInstances(false);
recoverRouterConfig.setAllRecoverEnable(polarisDiscoveryProperties.getAllRecoverEnabled());
// Update modified config to source properties
configuration.getConsumer().getServiceRouter()

@ -117,6 +117,11 @@ public class PolarisDiscoveryProperties {
*/
private Boolean preferIpv6 = false;
/**
* is all recover enable.
*/
private Boolean allRecoverEnabled = true;
public String getInstanceId() {
return instanceId;
}
@ -232,6 +237,14 @@ public class PolarisDiscoveryProperties {
this.preferIpv6 = preferIpv6;
}
public Boolean getAllRecoverEnabled() {
return allRecoverEnabled;
}
public void setAllRecoverEnabled(Boolean allRecoverEnabled) {
this.allRecoverEnabled = allRecoverEnabled;
}
public Boolean getEnabled() {
return enabled;
}
@ -270,6 +283,7 @@ public class PolarisDiscoveryProperties {
", zeroProtectionEnabled=" + zeroProtectionEnabled +
", zeroProtectionNeedTestConnectivity=" + zeroProtectionNeedTestConnectivity +
", preferIpv6=" + preferIpv6 +
", allRecoverEnabled=" + allRecoverEnabled +
'}';
}
}

@ -84,6 +84,12 @@
"defaultValue": false,
"description": "if prefer ipv6. Default: false."
},
{
"name": "spring.cloud.polaris.discovery.all-recover-enabled",
"type": "java.lang.Boolean",
"defaultValue": true,
"description": "is all recover enable. Default: true."
},
{
"name": "spring.cloud.polaris.discovery.eager-load.enabled",
"type": "java.lang.Boolean",

@ -88,6 +88,12 @@ public class PolarisDiscoveryPropertiesTest {
polarisDiscoveryProperties.setInstanceId("test-ins-id");
assertThat(polarisDiscoveryProperties.getInstanceId()).isEqualTo("test-ins-id");
polarisDiscoveryProperties.setPreferIpv6(true);
assertThat(polarisDiscoveryProperties.getPreferIpv6()).isTrue();
polarisDiscoveryProperties.setAllRecoverEnabled(false);
assertThat(polarisDiscoveryProperties.getAllRecoverEnabled()).isFalse();
assertThat(polarisDiscoveryProperties.toString())
.isEqualTo("PolarisDiscoveryProperties{"
+ "namespace='Test'"
@ -103,6 +109,7 @@ public class PolarisDiscoveryPropertiesTest {
+ ", serviceListRefreshInterval=1000"
+ ", zeroProtectionEnabled=false"
+ ", zeroProtectionNeedTestConnectivity=false"
+ ", preferIpv6=false}");
+ ", preferIpv6=true"
+ ", allRecoverEnabled=false}");
}
}

@ -173,6 +173,8 @@ public final class TsfCoreEnvironmentPostProcessor implements EnvironmentPostPro
environment.getProperty("spring.cloud.polaris.router.rule-router.fail-over", "none"));
defaultProperties.put("spring.cloud.polaris.router.namespace-router.enabled",
environment.getProperty("spring.cloud.polaris.router.namespace-router.enabled", "true"));
defaultProperties.put("spring.cloud.polaris.discovery.all-recover-enabled",
environment.getProperty("spring.cloud.polaris.discovery.all-recover-enabled", "false"));
}
}

Loading…
Cancel
Save