summaryrefslogtreecommitdiff
path: root/libpod/util.go
diff options
context:
space:
mode:
authorGiuseppe Scrivano <gscrivan@redhat.com>2019-09-04 14:35:37 +0200
committerGiuseppe Scrivano <gscrivan@redhat.com>2019-09-04 19:55:54 +0200
commit8e337aff5ae755794d0d7844d146f5f8533152bb (patch)
tree6b052d4c1698af5dc7602acc73c67302fed84b81 /libpod/util.go
parentf1a3e02aea68a37f85cb924c934be1bcc4131d7d (diff)
downloadpodman-8e337aff5ae755794d0d7844d146f5f8533152bb.tar.gz
podman-8e337aff5ae755794d0d7844d146f5f8533152bb.tar.bz2
podman-8e337aff5ae755794d0d7844d146f5f8533152bb.zip
libpod: avoid polling container status
use the inotify backend to be notified on the container exit instead of polling continuosly the runtime. Polling the runtime slowns significantly down the podman execution time for short lived processes: $ time bin/podman run --rm -ti fedora true real 0m0.324s user 0m0.088s sys 0m0.064s from: $ time podman run --rm -ti fedora true real 0m4.199s user 0m5.339s sys 0m0.344s Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
Diffstat (limited to 'libpod/util.go')
-rw-r--r--libpod/util.go6
1 files changed, 5 insertions, 1 deletions
diff --git a/libpod/util.go b/libpod/util.go
index b60575264..164800af4 100644
--- a/libpod/util.go
+++ b/libpod/util.go
@@ -69,7 +69,11 @@ func WaitForFile(path string, chWait chan error, timeout time.Duration) (bool, e
defer watcher.Close()
}
- timeoutChan := time.After(timeout)
+ var timeoutChan <-chan time.Time
+
+ if timeout != 0 {
+ timeoutChan = time.After(timeout)
+ }
for {
select {