Add batch check to container stats lock

Signed-off-by: Matthew Heon <matthew.heon@gmail.com>

Closes: #1249
Approved by: rhatdan
This commit is contained in:
Matthew Heon
2018-08-09 17:36:10 -04:00
committed by Atomic Bot
parent c27b7cdc93
commit 71c28c7cda

View File

@@ -16,11 +16,15 @@ func (c *Container) GetContainerStats(previousStats *ContainerStats) (*Container
stats := new(ContainerStats)
stats.ContainerID = c.ID()
stats.Name = c.Name()
if !c.batched {
c.lock.Lock()
defer c.lock.Unlock()
if err := c.syncContainer(); err != nil {
return stats, err
}
}
if c.state.State != ContainerStateRunning {
return stats, nil
}