aboutsummaryrefslogtreecommitdiff
path: root/libpod/stats.go
diff options
context:
space:
mode:
Diffstat (limited to 'libpod/stats.go')
-rw-r--r--libpod/stats.go12
1 files changed, 8 insertions, 4 deletions
diff --git a/libpod/stats.go b/libpod/stats.go
index 262c1ac00..7830919ba 100644
--- a/libpod/stats.go
+++ b/libpod/stats.go
@@ -16,11 +16,15 @@ func (c *Container) GetContainerStats(previousStats *ContainerStats) (*Container
stats := new(ContainerStats)
stats.ContainerID = c.ID()
stats.Name = c.Name()
- c.lock.Lock()
- defer c.lock.Unlock()
- if err := c.syncContainer(); err != nil {
- return stats, err
+
+ 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
}