From e6308d01b909136aad2c17a1121424809de69c69 Mon Sep 17 00:00:00 2001 From: CaptainB Date: Wed, 3 Aug 2022 11:48:37 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=80=A7=E8=83=BD=E6=B5=8B=E8=AF=95):=20?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=A4=9A=E8=8A=82=E7=82=B9=E9=83=A8=E7=BD=B2?= =?UTF-8?q?=E6=97=B6=E6=9F=A5=E8=AF=A2=E7=9B=91=E6=8E=A7targets=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E4=B8=8D=E4=B8=80=E8=87=B4=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1014830 --user=刘瑞斌 【性能测试】多节点部署时,添加自定义监控存在一致性问题 https://www.tapd.cn/55049933/s/1216239 --- .../src/main/java/io/metersphere/consul/ConsulService.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/backend/src/main/java/io/metersphere/consul/ConsulService.java b/backend/src/main/java/io/metersphere/consul/ConsulService.java index b02f2b662a..ab9c38b1c6 100644 --- a/backend/src/main/java/io/metersphere/consul/ConsulService.java +++ b/backend/src/main/java/io/metersphere/consul/ConsulService.java @@ -46,12 +46,10 @@ public class ConsulService { if (StringUtils.isNotEmpty(values)) { return objectMapper.readValue(values, TYPE_REFERENCE); } - Map> result = updateCache(); - stringRedisTemplate.opsForValue().set(RESOURCE_POOL_CACHE_KEY, objectMapper.writeValueAsString(result)); - return result; + return updateCache(); } - public Map> updateCache() { + public Map> updateCache() throws Exception { Map> 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; } }