mirror of
https://github.com/anchore/syft.git
synced 2026-02-12 02:26:42 +01:00
ignore partybus unsubscribe errors (#641)
Signed-off-by: Alex Goodman <alex.goodman@anchore.com>
This commit is contained in:
parent
f0b2d81599
commit
e3b34813d7
@ -14,7 +14,7 @@ import (
|
|||||||
// eventLoop listens to worker errors (from execution path), worker events (from a partybus subscription), and
|
// eventLoop listens to worker errors (from execution path), worker events (from a partybus subscription), and
|
||||||
// signal interrupts. Is responsible for handling each event relative to a given UI an to coordinate eventing until
|
// signal interrupts. Is responsible for handling each event relative to a given UI an to coordinate eventing until
|
||||||
// an eventual graceful exit.
|
// an eventual graceful exit.
|
||||||
// nolint:gocognit,funlen
|
// nolint:funlen
|
||||||
func eventLoop(workerErrs <-chan error, signals <-chan os.Signal, subscription *partybus.Subscription, cleanupFn func(), uxs ...ui.UI) error {
|
func eventLoop(workerErrs <-chan error, signals <-chan os.Signal, subscription *partybus.Subscription, cleanupFn func(), uxs ...ui.UI) error {
|
||||||
defer cleanupFn()
|
defer cleanupFn()
|
||||||
events := subscription.Events()
|
events := subscription.Events()
|
||||||
@ -41,9 +41,7 @@ func eventLoop(workerErrs <-chan error, signals <-chan os.Signal, subscription *
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
// capture the error from the worker and unsubscribe to complete a graceful shutdown
|
// capture the error from the worker and unsubscribe to complete a graceful shutdown
|
||||||
retErr = multierror.Append(retErr, err)
|
retErr = multierror.Append(retErr, err)
|
||||||
if err := subscription.Unsubscribe(); err != nil {
|
_ = subscription.Unsubscribe()
|
||||||
retErr = multierror.Append(retErr, err)
|
|
||||||
}
|
|
||||||
// the worker has exited, we may have been mid-handling events for the UI which should now be
|
// the worker has exited, we may have been mid-handling events for the UI which should now be
|
||||||
// ignored, in which case forcing a teardown of the UI irregardless of the state is required.
|
// ignored, in which case forcing a teardown of the UI irregardless of the state is required.
|
||||||
forceTeardown = true
|
forceTeardown = true
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user