Skip to content

Commit 942addf

Browse files
authored
fix: discovery index may not change in tsf consul (#636)
1 parent 7acc0d1 commit 942addf

File tree

1 file changed

+2
-4
lines changed
  • polaris-plugins/polaris-plugins-connector/connector-consul/src/main/java/com/tencent/polaris/plugins/connector/consul/service

1 file changed

+2
-4
lines changed

polaris-plugins/polaris-plugins-connector/connector-consul/src/main/java/com/tencent/polaris/plugins/connector/consul/service/InstanceService.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,16 +89,14 @@ public void sendRequest(ServiceUpdateTask serviceUpdateTask) {
8989
UrlParameters nsTypeParam = StringUtils.isNotBlank(consulContext.getNamespaceType()) ? new SingleUrlParameters("nsType", consulContext.getNamespaceType()) : null;;
9090
UrlParameters namespaceParameter = StringUtils.isNotBlank(namespace) ? new SingleUrlParameters("nid", namespace) : null;;
9191
Long currentIndex = getServersConsulIndex(serviceId);
92-
int code = ServerCodes.DATA_NO_CHANGE;
92+
// in tsf consul, changes in instance status may not alter the index, requiring updates each time.
93+
int code = ServerCodes.EXECUTE_SUCCESS;
9394
QueryParams queryParams = new QueryParams(consulContext.getWaitTime(), currentIndex);
9495
try {
9596
LOG.debug("Begin get service instances of :{}/{} sync", namespace, serviceId);
9697
HttpResponse rawResponse = consulRawClient.makeGetRequest("/v1/health/service/" + serviceId, tagParams,
9798
passingParams, tokenParam, nsTypeParam, namespaceParameter, queryParams);
9899
if (rawResponse != null) {
99-
if (!currentIndex.equals(rawResponse.getConsulIndex())) {
100-
code = ServerCodes.EXECUTE_SUCCESS;
101-
}
102100
LOG.debug("raw response: " + rawResponse.getContent() + " ; onlyPassing: " + onlyPassing);
103101
List<HealthService> value;
104102
if (rawResponse.getStatusCode() == 200) {

0 commit comments

Comments
 (0)