Skip to content

Commit

Permalink
Added a litmit to the StatsHistory
Browse files Browse the repository at this point in the history
  • Loading branch information
mjarkk committed Jul 5, 2019
1 parent 787bff1 commit 8ef19b7
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion pkg/commands/docker.go
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,12 @@ func (c *DockerCommand) createClientStatMonitor(container *Container) {
}

c.ContainerMutex.Lock()
container.StatHistory = append(container.StatHistory, recordedStats)
toSlice := len(container.StatHistory) - 50
if toSlice < 0 {
toSlice = 0
}
container.StatHistory = append(container.StatHistory[toSlice:], recordedStats)

container.EraseOldHistory()
c.ContainerMutex.Unlock()
}
Expand Down

0 comments on commit 8ef19b7

Please sign in to comment.