summaryrefslogtreecommitdiff
path: root/libpod/events/logfile.go
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2020-07-21 10:55:40 -0400
committerGitHub <noreply@github.com>2020-07-21 10:55:40 -0400
commitf8e2a3500e3daadf21137d1647cabf9ef20b2114 (patch)
treea4825917b192332599841cdcc41096af39a4b474 /libpod/events/logfile.go
parent644b5bc8a35760654824c46cad8618e0d6e634bc (diff)
parentdea93c27d2809cd5a04563d27cf00a8e682884c8 (diff)
downloadpodman-f8e2a3500e3daadf21137d1647cabf9ef20b2114.tar.gz
podman-f8e2a3500e3daadf21137d1647cabf9ef20b2114.tar.bz2
podman-f8e2a3500e3daadf21137d1647cabf9ef20b2114.zip
Merge pull request #6902 from vrothberg/events-endpoint
events endpoint: fix panic and race condition
Diffstat (limited to 'libpod/events/logfile.go')
-rw-r--r--libpod/events/logfile.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/libpod/events/logfile.go b/libpod/events/logfile.go
index 28d0dc07e..b70102450 100644
--- a/libpod/events/logfile.go
+++ b/libpod/events/logfile.go
@@ -63,6 +63,14 @@ func (e EventLogFile) Read(ctx context.Context, options ReadOptions) error {
}
}()
for line := range t.Lines {
+ select {
+ case <-ctx.Done():
+ // the consumer has cancelled
+ return nil
+ default:
+ // fallthrough
+ }
+
event, err := newEventFromJSONString(line.Text)
if err != nil {
return err