summaryrefslogtreecommitdiff
path: root/libpod
diff options
context:
space:
mode:
authorjgallucci32 <john.gallucci.iv@gmail.com>2020-06-21 09:31:22 -0700
committerMatthew Heon <mheon@redhat.com>2020-06-24 14:35:12 -0400
commit03f952cfa89ac40e493a4ad666abeae1298c0cd7 (patch)
tree0e10151687af7474582e968e4ca928cca17d49fd /libpod
parent07f535d8b7595388e9e45203f2d7a77cbf78b977 (diff)
downloadpodman-03f952cfa89ac40e493a4ad666abeae1298c0cd7.tar.gz
podman-03f952cfa89ac40e493a4ad666abeae1298c0cd7.tar.bz2
podman-03f952cfa89ac40e493a4ad666abeae1298c0cd7.zip
Use POLL_DURATION for timer
Signed-off-by: jgallucci32 <john.gallucci.iv@gmail.com>
Diffstat (limited to 'libpod')
-rw-r--r--libpod/container_log.go5
1 files changed, 2 insertions, 3 deletions
diff --git a/libpod/container_log.go b/libpod/container_log.go
index 9a2f8aa2f..67380397a 100644
--- a/libpod/container_log.go
+++ b/libpod/container_log.go
@@ -7,6 +7,7 @@ import (
"github.com/containers/libpod/libpod/define"
"github.com/containers/libpod/libpod/logs"
+ "github.com/hpcloud/tail/watch"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
)
@@ -88,8 +89,8 @@ func (c *Container) readFromLogFile(options *logs.LogOptions, logChannel chan *l
go func() {
for {
state, err := c.State()
+ time.Sleep(watch.POLL_DURATION)
if err != nil {
- time.Sleep(250 * time.Millisecond)
tailError := t.StopAtEOF()
if tailError != nil && fmt.Sprintf("%v", tailError) != "tail: stop at eof" {
logrus.Error(tailError)
@@ -100,14 +101,12 @@ func (c *Container) readFromLogFile(options *logs.LogOptions, logChannel chan *l
break
}
if state != define.ContainerStateRunning && state != define.ContainerStatePaused {
- time.Sleep(250 * time.Millisecond)
tailError := t.StopAtEOF()
if tailError != nil && fmt.Sprintf("%v", tailError) != "tail: stop at eof" {
logrus.Error(tailError)
}
break
}
- time.Sleep(250 * time.Millisecond)
}
}()
}