Fixes #22030
Because the publisher uses this same value to all the
stats endpoints we need to make a copy of this as soon as we get it so
that we can make our modifications without it affecting others.
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
| ... | ... |
@@ -43,11 +43,11 @@ func (daemon *Daemon) ContainerStats(ctx context.Context, prefixOrName string, c |
| 43 | 43 |
|
| 44 | 44 |
var preCPUStats types.CPUStats |
| 45 | 45 |
getStatJSON := func(v interface{}) *types.StatsJSON {
|
| 46 |
- ss := v.(*types.StatsJSON) |
|
| 46 |
+ ss := v.(types.StatsJSON) |
|
| 47 | 47 |
ss.PreCPUStats = preCPUStats |
| 48 | 48 |
// ss.MemoryStats.Limit = uint64(update.MemoryLimit) |
| 49 | 49 |
preCPUStats = ss.CPUStats |
| 50 |
- return ss |
|
| 50 |
+ return &ss |
|
| 51 | 51 |
} |
| 52 | 52 |
|
| 53 | 53 |
enc := json.NewEncoder(outStream) |