From 015a04fac6df267f0ba3a1abb1df35f5e18afec7 Mon Sep 17 00:00:00 2001 From: Jesse Duffield Date: Sat, 8 Jul 2023 15:22:26 +1000 Subject: [PATCH] Remove redundant waitgroup Turns out we're just running our refresh functions one after the other which isn't ideal but we can fix that separately. As it stands this wait group isn't doing anything. --- pkg/gui/controllers/helpers/refresh_helper.go | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/pkg/gui/controllers/helpers/refresh_helper.go b/pkg/gui/controllers/helpers/refresh_helper.go index 67e6dc909..5c5e470b3 100644 --- a/pkg/gui/controllers/helpers/refresh_helper.go +++ b/pkg/gui/controllers/helpers/refresh_helper.go @@ -63,8 +63,6 @@ func (self *RefreshHelper) Refresh(options types.RefreshOptions) error { ) } - wg := sync.WaitGroup{} - f := func() { var scopeSet *set.Set[types.RefreshableView] if len(options.Scope) == 0 { @@ -87,15 +85,11 @@ func (self *RefreshHelper) Refresh(options types.RefreshOptions) error { } refresh := func(f func()) { - wg.Add(1) - func() { - if options.Mode == types.ASYNC { - self.c.OnWorker(f) - } else { - f() - } - wg.Done() - }() + if options.Mode == types.ASYNC { + self.c.OnWorker(f) + } else { + f() + } } if scopeSet.Includes(types.COMMITS) || scopeSet.Includes(types.BRANCHES) || scopeSet.Includes(types.REFLOG) || scopeSet.Includes(types.BISECT_INFO) { @@ -143,8 +137,6 @@ func (self *RefreshHelper) Refresh(options types.RefreshOptions) error { refresh(func() { _ = self.mergeConflictsHelper.RefreshMergeState() }) } - wg.Wait() - self.refreshStatus() if options.Then != nil {