diff --git a/pkg/commands/container_stats.go b/pkg/commands/container_stats.go index 419782dd..f011194f 100644 --- a/pkg/commands/container_stats.go +++ b/pkg/commands/container_stats.go @@ -175,6 +175,9 @@ func (c *Container) eraseOldHistory(maxDuration time.Duration) { return } } + + // All entries are older than maxDuration, clear the history + c.StatHistory = nil } func (c *Container) GetLastStats() (*RecordedStats, bool) { diff --git a/pkg/commands/pod.go b/pkg/commands/pod.go index 909e9ec7..92928c8c 100644 --- a/pkg/commands/pod.go +++ b/pkg/commands/pod.go @@ -69,6 +69,9 @@ func (p *Pod) eraseOldHistory(maxDuration time.Duration) { return } } + + // All entries are older than maxDuration, clear the history + p.StatHistory = nil } // GetLastStats returns the most recent stats entry.