Added a litmit to the StatsHistory

This commit is contained in:
mjarkk 2019-07-05 08:10:21 +02:00
parent 787bff1102
commit 8ef19b781d
No known key found for this signature in database
GPG key ID: 147D0BE9258C6C95

View file

@ -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()
}