summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjgallucci32 <john.gallucci.iv@gmail.com>2020-06-21 09:31:22 -0700
committerjgallucci32 <john.gallucci.iv@gmail.com>2020-06-21 09:31:22 -0700
commit8926e1f03bc82d75a295a0784c2756ea37c9b031 (patch)
treee7a07898465c2fc84a2e65b8235ecc63c50c60bd
parent78dd4f2ecb9f85fda87e581b9b2800618223154f (diff)
downloadpodman-8926e1f03bc82d75a295a0784c2756ea37c9b031.tar.gz
podman-8926e1f03bc82d75a295a0784c2756ea37c9b031.tar.bz2
podman-8926e1f03bc82d75a295a0784c2756ea37c9b031.zip
Use POLL_DURATION for timer
Signed-off-by: jgallucci32 <john.gallucci.iv@gmail.com>
-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)
}
}()
}