mirror of
https://github.com/docker/docs.git
synced 2026-03-29 23:38:56 +07:00
Merge pull request #22120 from crosbymichael/stats-panic
Create a copy of stats value before modifications
This commit is contained in:
@@ -43,11 +43,11 @@ func (daemon *Daemon) ContainerStats(ctx context.Context, prefixOrName string, c
|
||||
|
||||
var preCPUStats types.CPUStats
|
||||
getStatJSON := func(v interface{}) *types.StatsJSON {
|
||||
ss := v.(*types.StatsJSON)
|
||||
ss := v.(types.StatsJSON)
|
||||
ss.PreCPUStats = preCPUStats
|
||||
// ss.MemoryStats.Limit = uint64(update.MemoryLimit)
|
||||
preCPUStats = ss.CPUStats
|
||||
return ss
|
||||
return &ss
|
||||
}
|
||||
|
||||
enc := json.NewEncoder(outStream)
|
||||
|
||||
@@ -135,7 +135,7 @@ func (s *statsCollector) run() {
|
||||
// FIXME: move to containerd
|
||||
stats.CPUStats.SystemUsage = systemUsage
|
||||
|
||||
pair.publisher.Publish(stats)
|
||||
pair.publisher.Publish(*stats)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user