From d5b425e1b54953d5550171af0a808bc87038483f Mon Sep 17 00:00:00 2001 From: Alex Goodman Date: Fri, 22 Oct 2021 13:44:50 -0400 Subject: [PATCH] force exiting the etui upon worker error (#583) Signed-off-by: Alex Goodman --- Makefile | 2 +- cmd/event_loop.go | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 54baf451d..8216047c2 100644 --- a/Makefile +++ b/Makefile @@ -250,7 +250,7 @@ cli: $(SNAPSHOTDIR) ## Run CLI tests SYFT_BINARY_LOCATION='$(SNAPSHOT_CMD)' \ go test -count=1 -v ./test/cli -.PHONY: changlog-release +.PHONY: changelog-release changelog-release: $(TEMPDIR)/chronicle --since-tag $(SECOND_TO_LAST_TAG) --until-tag $(LAST_TAG) -vv > CHANGELOG.md diff --git a/cmd/event_loop.go b/cmd/event_loop.go index 95707d071..53a2dd90f 100644 --- a/cmd/event_loop.go +++ b/cmd/event_loop.go @@ -44,6 +44,9 @@ func eventLoop(workerErrs <-chan error, signals <-chan os.Signal, subscription * if err := subscription.Unsubscribe(); err != nil { retErr = multierror.Append(retErr, err) } + // 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. + forceTeardown = true } case e, isOpen := <-events: if !isOpen { @@ -53,7 +56,6 @@ func eventLoop(workerErrs <-chan error, signals <-chan os.Signal, subscription * if err := ux.Handle(e); err != nil { if errors.Is(err, partybus.ErrUnsubscribe) { - log.Warnf("unable to unsubscribe from the event bus") events = nil } else { retErr = multierror.Append(retErr, err)