Added the sugestion from @jesseduffeild

This commit is contained in:
mjarkk 2019-07-05 16:58:06 +02:00
parent 8ef19b781d
commit 58baf82519
No known key found for this signature in database
GPG key ID: 147D0BE9258C6C95
2 changed files with 7 additions and 6 deletions

View file

@ -179,12 +179,7 @@ func (c *DockerCommand) createClientStatMonitor(container *Container) {
}
c.ContainerMutex.Lock()
toSlice := len(container.StatHistory) - 50
if toSlice < 0 {
toSlice = 0
}
container.StatHistory = append(container.StatHistory[toSlice:], recordedStats)
container.StatHistory = append(container.StatHistory, recordedStats)
container.EraseOldHistory()
c.ContainerMutex.Unlock()
}

View file

@ -289,6 +289,11 @@ type CustomCommand struct {
// the boolean zero value and this will be ignored when parsing the user's
// config
func GetDefaultConfig() UserConfig {
duration, err := time.ParseDuration("3m")
if err != nil {
panic(err)
}
return UserConfig{
Gui: GuiConfig{
ScrollHeight: 2,
@ -336,6 +341,7 @@ func GetDefaultConfig() UserConfig {
Method: "never",
},
Stats: StatsConfig{
MaxDuration: duration,
Graphs: []GraphConfig{
{
Caption: "CPU (%)",