Skip to content

Commit

Permalink
empty check
Browse files Browse the repository at this point in the history
  • Loading branch information
tylerwowen committed Jul 26, 2023
1 parent 62e7f36 commit 9c1a848
Showing 1 changed file with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import java.util.Map;
import java.util.Set;

import org.apache.commons.collections.CollectionUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand Down Expand Up @@ -129,6 +130,11 @@ private void determineStaleHostCandidates() {
LOG.error("failed to get unreachable hosts", ex);
return;
}

if (CollectionUtils.isEmpty(unreachableHosts)) {
return;
}

ArrayList<String> unreachableHostIds = new ArrayList<>();
unreachableHosts.stream().map(hostAgent -> unreachableHostIds.add(hostAgent.getHost_id()));

Expand Down Expand Up @@ -158,6 +164,10 @@ private void processStaleHosts() {
return;
}

if (CollectionUtils.isEmpty(staleHosts)) {
return;
}

Map<String, HostAgentBean> staleHostMap = new HashMap<>();
staleHosts.stream().map(hostAgent -> staleHostMap.put(hostAgent.getHost_id(), hostAgent));

Expand Down Expand Up @@ -193,6 +203,10 @@ private void cleanUpAgentlessHosts() {
return;
}

if (CollectionUtils.isEmpty(agentlessHosts)) {
return;
}

Set<String> terminatedHosts = getTerminatedHostsFromSource(agentlessHosts);
for (String hostId : agentlessHosts) {
if (terminatedHosts.contains(hostId)) {
Expand Down

0 comments on commit 9c1a848

Please sign in to comment.