Skip to content

Commit

Permalink
add check to catch containers in restart loop. closes #103
Browse files Browse the repository at this point in the history
  • Loading branch information
henrygd committed Aug 19, 2024
1 parent 58fe9f7 commit 7cf7b70
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions beszel/internal/agent/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,11 @@ func (a *Agent) getContainerStats(ctr *container.ApiInfo) (*container.Stats, err

name := ctr.Names[0][1:]

// check if container has valid data, otherwise may be in restart loop (#103)
if len(statsJson.Networks) == 0 {
return nil, fmt.Errorf("%s - invalid data", name)
}

// memory (https://docs.docker.com/reference/cli/docker/container/stats/)
memCache := statsJson.MemoryStats.Stats["inactive_file"]
if memCache == 0 {
Expand Down

0 comments on commit 7cf7b70

Please sign in to comment.