Skip to content

Commit

Permalink
style: rewrite description assign in CheckResultCache in if-else
Browse files Browse the repository at this point in the history
  • Loading branch information
Lambert-Rao committed Mar 1, 2024
1 parent d276bff commit 03be1d6
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,10 @@ public void update(String type, Long typeId, HealthCheckStatus status, String re
cacheMap.put(type, subMap);
}
CheckResult oldResult = subMap.get(typeId);
String oldDesc = Objects.isNull(oldResult.getResultDesc()) || oldResult.getResultDesc().isEmpty() ? ""
: oldResult.getResultDesc() + HealthConstant.NEW_LINE_ENDING;
String description = oldDesc + resultDesc;
String description = resultDesc;
if (oldResult.getResultDesc() != null && !oldResult.getResultDesc().isEmpty()) {
description = oldResult.getResultDesc() + HealthConstant.NEW_LINE_ENDING + resultDesc;
}
description += " Latency: " + latency.toString() + "ms";
CheckResult result = new CheckResult(status, description, LocalDateTime.now(),
latency, oldResult.getConfig());
Expand All @@ -57,7 +58,6 @@ public void update(String type, Long typeId, HealthCheckStatus status, String re
subMap = new HashMap<>();
cacheMap.put(type, subMap);
}
CheckResult resultToUpdate = subMap.get(typeId);
subMap.put(typeId, new CheckResult(status, resultDesc, LocalDateTime.now(), latency, config));
}

Expand Down

0 comments on commit 03be1d6

Please sign in to comment.