mirror of
https://github.com/containers/podman.git
synced 2025-12-08 23:00:23 +08:00
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:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user