diff options
author | Paul Holzinger <pholzing@redhat.com> | 2022-09-09 13:31:03 +0200 |
---|---|---|
committer | Paul Holzinger <pholzing@redhat.com> | 2022-09-12 18:05:17 +0200 |
commit | cd32b929e35cdb2d6b49853a7b0e5d93921b0979 (patch) | |
tree | 07c3f5bd0561995f0d4f6fe46c9ce647ae82fcfa /libpod | |
parent | 76980a2226278eca1c0b31224ae7bdce59d5eabb (diff) | |
download | podman-cd32b929e35cdb2d6b49853a7b0e5d93921b0979.tar.gz podman-cd32b929e35cdb2d6b49853a7b0e5d93921b0979.tar.bz2 podman-cd32b929e35cdb2d6b49853a7b0e5d93921b0979.zip |
libpod: runtime newEventer() cleanup
There is no reason to create a new eventer every time. The libpod runtime
already has one attached which should be used instead.
Signed-off-by: Paul Holzinger <pholzing@redhat.com>
Diffstat (limited to 'libpod')
-rw-r--r-- | libpod/events.go | 12 |
1 files changed, 2 insertions, 10 deletions
diff --git a/libpod/events.go b/libpod/events.go index 60142cb60..ad9c5eafe 100644 --- a/libpod/events.go +++ b/libpod/events.go @@ -133,11 +133,7 @@ func (v *Volume) newVolumeEvent(status events.Status) { // Events is a wrapper function for everyone to begin tailing the events log // with options func (r *Runtime) Events(ctx context.Context, options events.ReadOptions) error { - eventer, err := r.newEventer() - if err != nil { - return err - } - return eventer.Read(ctx, options) + return r.eventer.Read(ctx, options) } // GetEvents reads the event log and returns events based on input filters @@ -149,10 +145,6 @@ func (r *Runtime) GetEvents(ctx context.Context, filters []string) ([]*events.Ev FromStart: true, Stream: false, } - eventer, err := r.newEventer() - if err != nil { - return nil, err - } logEvents := make([]*events.Event, 0, len(eventChannel)) readLock := sync.Mutex{} @@ -164,7 +156,7 @@ func (r *Runtime) GetEvents(ctx context.Context, filters []string) ([]*events.Ev readLock.Unlock() }() - readErr := eventer.Read(ctx, options) + readErr := r.eventer.Read(ctx, options) readLock.Lock() // Wait for the events to be consumed. return logEvents, readErr } |