Skip to content

Commit

Permalink
[ISSUE alibaba#2810] don't send beat when standalone model (alibaba#3047
Browse files Browse the repository at this point in the history
)

* don't send beat when standalone model

* format the code.
  • Loading branch information
horizonzy authored Jun 17, 2020
1 parent 7c4cca4 commit aea7dd6
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
Expand Down Expand Up @@ -683,7 +682,8 @@ public Integer onCompleted(Response response) throws Exception {
return 1;
}

List<JsonNode> datumList = JacksonUtils.toObj(response.getResponseBody(), new TypeReference<List<JsonNode>>() {});
List<JsonNode> datumList = JacksonUtils.toObj(response.getResponseBody(), new TypeReference<List<JsonNode>>() {
});

for (JsonNode datumJson : datumList) {
OPERATE_LOCK.lock();
Expand Down

0 comments on commit aea7dd6

Please sign in to comment.