fix(性能测试): 修复多节点部署时查询监控targets数据不一致的问题

--bug=1014830 --user=刘瑞斌 【性能测试】多节点部署时,添加自定义监控存在一致性问题 https://www.tapd.cn/55049933/s/1216239
This commit is contained in:
CaptainB 2022-08-03 11:48:37 +08:00 committed by 刘瑞斌
parent 7aa46fceec
commit e6308d01b9
1 changed files with 3 additions and 4 deletions

View File

@ -46,12 +46,10 @@ public class ConsulService {
if (StringUtils.isNotEmpty(values)) {
return objectMapper.readValue(values, TYPE_REFERENCE);
}
Map<String, List<String>> result = updateCache();
stringRedisTemplate.opsForValue().set(RESOURCE_POOL_CACHE_KEY, objectMapper.writeValueAsString(result));
return result;
return updateCache();
}
public Map<String, List<String>> updateCache() {
public Map<String, List<String>> updateCache() throws Exception {
Map<String, List<String>> result = new HashMap<>();
QueryResourcePoolRequest resourcePoolRequest = new QueryResourcePoolRequest();
@ -89,6 +87,7 @@ public class ConsulService {
result.put(node.getIp() + "-" + port, Collections.singletonList("metersphere"));
}
}
stringRedisTemplate.opsForValue().set(RESOURCE_POOL_CACHE_KEY, objectMapper.writeValueAsString(result));
return result;
}
}