diff --git a/naming/src/main/java/com/alibaba/nacos/naming/consistency/persistent/raft/RaftCore.java b/naming/src/main/java/com/alibaba/nacos/naming/consistency/persistent/raft/RaftCore.java index 8f550fb73f7..f8e05256566 100644 --- a/naming/src/main/java/com/alibaba/nacos/naming/consistency/persistent/raft/RaftCore.java +++ b/naming/src/main/java/com/alibaba/nacos/naming/consistency/persistent/raft/RaftCore.java @@ -484,10 +484,9 @@ public void run() { public void sendBeat() throws IOException, InterruptedException { RaftPeer local = peers.local(); - if (local.state != RaftPeer.State.LEADER && !ApplicationUtils.getStandaloneMode()) { + if (ApplicationUtils.getStandaloneMode() || local.state != RaftPeer.State.LEADER) { return; } - if (Loggers.RAFT.isDebugEnabled()) { Loggers.RAFT.debug("[RAFT] send beat with {} keys.", datums.size()); } @@ -683,7 +682,8 @@ public Integer onCompleted(Response response) throws Exception { return 1; } - List datumList = JacksonUtils.toObj(response.getResponseBody(), new TypeReference>() {}); + List datumList = JacksonUtils.toObj(response.getResponseBody(), new TypeReference>() { + }); for (JsonNode datumJson : datumList) { OPERATE_LOCK.lock();