Skip to content

Commit

Permalink
Handle Agent without host (#1443)
Browse files Browse the repository at this point in the history
Usually the host being checked is not terminated. However there might be some synchronization latency. Mark it as not stale and we will handle it in the next run.
This will reduce error budget noise.
  • Loading branch information
tylerwowen authored Feb 6, 2024
1 parent 05c0b30 commit 8725fde
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -121,11 +121,17 @@ private boolean isHostStale(HostAgentBean hostAgentBean) {

HostBean hostBean;
try {
hostBean = hostDAO.getHostsByHostId(hostAgentBean.getHost_id()).get(0);
List<HostBean> hostBeans = hostDAO.getHostsByHostId(hostAgentBean.getHost_id());
if (hostBeans.isEmpty()) {
// Usually the host being checked is not terminated. However there might be some
// synchronization latency.
// Mark it as not stale and we will handle it in the next run.
return false;
}
hostBean = hostBeans.get(0);
} catch (Exception ex) {
LOG.error("failed to get host bean for ({}), {}", hostAgentBean, ex);
errorBudgetFailure.increment();

return false;
}

Expand Down

0 comments on commit 8725fde

Please sign in to comment.