diff options
author | Daniel J Walsh <dwalsh@redhat.com> | 2018-09-10 16:03:52 -0400 |
---|---|---|
committer | Daniel J Walsh <dwalsh@redhat.com> | 2018-09-13 10:11:00 -0400 |
commit | 9ec82caa3147d7afaf9361748661c8868194d132 (patch) | |
tree | 4de0f051226e638819f2d4e34174b39e4b203c8a /libpod/container_api.go | |
parent | 61eda671eca96b6fa32369572d9b49850895d37b (diff) | |
download | podman-9ec82caa3147d7afaf9361748661c8868194d132.tar.gz podman-9ec82caa3147d7afaf9361748661c8868194d132.tar.bz2 podman-9ec82caa3147d7afaf9361748661c8868194d132.zip |
Add --interval flag to podman wait
Waiting uses a lot of CPU, so drop back to checking once/second
and allow user to pass in the interval.
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
Diffstat (limited to 'libpod/container_api.go')
-rw-r--r-- | libpod/container_api.go | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/libpod/container_api.go b/libpod/container_api.go index 86e2370ea..437699bae 100644 --- a/libpod/container_api.go +++ b/libpod/container_api.go @@ -592,12 +592,11 @@ func (c *Container) Inspect(size bool) (*inspect.ContainerInspectData, error) { } // Wait blocks on a container to exit and returns its exit code -func (c *Container) Wait() (int32, error) { +func (c *Container) Wait(waitTimeout time.Duration) (int32, error) { if !c.valid { return -1, ErrCtrRemoved } - - err := wait.PollImmediateInfinite(100*time.Millisecond, + err := wait.PollImmediateInfinite(waitTimeout*time.Millisecond, func() (bool, error) { stopped, err := c.isStopped() if err != nil { |