diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2020-07-21 10:55:40 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-07-21 10:55:40 -0400 |
commit | f8e2a3500e3daadf21137d1647cabf9ef20b2114 (patch) | |
tree | a4825917b192332599841cdcc41096af39a4b474 /libpod/events/logfile.go | |
parent | 644b5bc8a35760654824c46cad8618e0d6e634bc (diff) | |
parent | dea93c27d2809cd5a04563d27cf00a8e682884c8 (diff) | |
download | podman-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.go | 8 |
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 |