Reduced code complexity

This commit is contained in:
Volodymyr Babak 2022-04-20 12:57:04 +03:00
parent 604f5b8d25
commit f5b22510af

View File

@ -399,14 +399,10 @@ public final class EdgeGrpcSession implements Closeable {
Runnable sendDownlinkMsgsTask = () -> {
try {
if (isConnected() && sessionState.getPendingMsgsMap().values().size() > 0) {
List<DownlinkMsg> copy = null;
List<DownlinkMsg> copy = new ArrayList<>(sessionState.getPendingMsgsMap().values());
if (!firstRun) {
copy = new ArrayList<>(sessionState.getPendingMsgsMap().values());
log.warn("[{}] Failed to deliver the batch: {}", this.sessionId, copy);
}
if (copy == null) {
copy = new ArrayList<>(sessionState.getPendingMsgsMap().values());
}
log.trace("[{}] [{}] downlink msg(s) are going to be send.", this.sessionId, copy.size());
for (DownlinkMsg downlinkMsg : copy) {
sendDownlinkMsg(ResponseMsg.newBuilder()