From 1ad8aabe8ba229782354755df52e079ba161692a Mon Sep 17 00:00:00 2001 From: WuLang <48200100+wulangcode@users.noreply.github.com> Date: Sun, 23 Oct 2022 22:07:35 +0800 Subject: [PATCH] feat:Early method return (#823) --- .../cn/hippo4j/springboot/starter/core/ClientWorker.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hippo4j-spring-boot/hippo4j-spring-boot-starter/src/main/java/cn/hippo4j/springboot/starter/core/ClientWorker.java b/hippo4j-spring-boot/hippo4j-spring-boot-starter/src/main/java/cn/hippo4j/springboot/starter/core/ClientWorker.java index aef764e3..aa997763 100644 --- a/hippo4j-spring-boot/hippo4j-spring-boot-starter/src/main/java/cn/hippo4j/springboot/starter/core/ClientWorker.java +++ b/hippo4j-spring-boot/hippo4j-spring-boot-starter/src/main/java/cn/hippo4j/springboot/starter/core/ClientWorker.java @@ -154,6 +154,9 @@ public class ClientWorker { } public List checkUpdateTpIds(String probeUpdateString, boolean isInitializingCacheList) { + if (StringUtils.isEmpty(probeUpdateString)) { + return Collections.emptyList(); + } Map params = new HashMap(2); params.put(PROBE_MODIFY_REQUEST, probeUpdateString); params.put(WEIGHT_CONFIGS, IdUtil.simpleUUID()); @@ -165,9 +168,6 @@ public class ClientWorker { if (isInitializingCacheList) { headers.put(LONG_PULLING_TIMEOUT_NO_HANGUP, "true"); } - if (StringUtils.isEmpty(probeUpdateString)) { - return Collections.emptyList(); - } try { long readTimeoutMs = timeout + (long) Math.round(timeout >> 1); Result result = agent.httpPostByConfig(LISTENER_PATH, headers, params, readTimeoutMs);