diff --git a/CHANGELOG.md b/CHANGELOG.md index 9e04ae2e0..31381bb1b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,4 +18,5 @@ - [feat:support fault injection.](https://github.com/Tencent/spring-cloud-tencent/pull/1672) - [feat: support config event and monitor address list.](https://github.com/Tencent/spring-cloud-tencent/pull/1675) - [feat:Modify the annotations.](https://github.com/Tencent/spring-cloud-tencent/pull/1678) +- [fix: polaris.discovery.heartbeat.enabled not effective.](https://github.com/Tencent/spring-cloud-tencent/pull/1680) - [feat: support config ratelimit addresses and remote task interval.](https://github.com/Tencent/spring-cloud-tencent/pull/1679) diff --git a/spring-cloud-starter-tencent-polaris-discovery/src/main/java/com/tencent/cloud/polaris/PolarisDiscoveryProperties.java b/spring-cloud-starter-tencent-polaris-discovery/src/main/java/com/tencent/cloud/polaris/PolarisDiscoveryProperties.java index 5c7b3b5fe..4eb8d1fe6 100644 --- a/spring-cloud-starter-tencent-polaris-discovery/src/main/java/com/tencent/cloud/polaris/PolarisDiscoveryProperties.java +++ b/spring-cloud-starter-tencent-polaris-discovery/src/main/java/com/tencent/cloud/polaris/PolarisDiscoveryProperties.java @@ -83,6 +83,11 @@ public class PolarisDiscoveryProperties { @Value("${spring.cloud.polaris.discovery.register:#{true}}") private Boolean registerEnabled; + /** + * Enable heartbeat or not. + */ + private Boolean heartbeatEnabled = true; + /** * Heartbeat interval ( 0 < interval <= 60). * Time unit: second. Default: 5. @@ -208,6 +213,14 @@ public class PolarisDiscoveryProperties { this.serviceListRefreshInterval = serviceListRefreshInterval; } + public Boolean getHeartbeatEnabled() { + return heartbeatEnabled; + } + + public void setHeartbeatEnabled(Boolean heartbeatEnabled) { + this.heartbeatEnabled = heartbeatEnabled; + } + public Integer getHeartbeatInterval() { if (this.heartbeatInterval <= 0 || this.heartbeatInterval > 60) { heartbeatInterval = DEFAULT_REGISTRY_HEARTBEAT_TIME_INTERVAL; @@ -291,6 +304,7 @@ public class PolarisDiscoveryProperties { ", protocol='" + protocol + '\'' + ", enabled=" + enabled + ", registerEnabled=" + registerEnabled + + ", heartbeatEnabled=" + heartbeatEnabled + ", heartbeatInterval=" + heartbeatInterval + ", healthCheckUrl='" + healthCheckUrl + '\'' + ", serviceListRefreshInterval=" + serviceListRefreshInterval + diff --git a/spring-cloud-starter-tencent-polaris-discovery/src/main/java/com/tencent/cloud/polaris/registry/PolarisServiceRegistry.java b/spring-cloud-starter-tencent-polaris-discovery/src/main/java/com/tencent/cloud/polaris/registry/PolarisServiceRegistry.java index 952b7c3be..58419a761 100644 --- a/spring-cloud-starter-tencent-polaris-discovery/src/main/java/com/tencent/cloud/polaris/registry/PolarisServiceRegistry.java +++ b/spring-cloud-starter-tencent-polaris-discovery/src/main/java/com/tencent/cloud/polaris/registry/PolarisServiceRegistry.java @@ -127,7 +127,6 @@ public class PolarisServiceRegistry implements ServiceRegistry