Merge pull request #10766 from cpuguy83/stats_pull_once

Allow pulling stats once and disconnecting.
This commit is contained in:
Tibor Vass
2015-05-04 22:28:01 -07:00
11 changed files with 83 additions and 10 deletions
+4 -1
View File
@@ -10,7 +10,7 @@ import (
"github.com/docker/libcontainer/cgroups"
)
func (daemon *Daemon) ContainerStats(name string, out io.Writer) error {
func (daemon *Daemon) ContainerStats(name string, stream bool, out io.Writer) error {
updates, err := daemon.SubscribeToContainerStats(name)
if err != nil {
return err
@@ -27,6 +27,9 @@ func (daemon *Daemon) ContainerStats(name string, out io.Writer) error {
daemon.UnsubscribeToContainerStats(name, updates)
return err
}
if !stream {
break
}
}
return nil
}