diff options
author | Jesse Duffield <jessedduffield@gmail.com> | 2020-03-26 23:48:11 +1100 |
---|---|---|
committer | Jesse Duffield <jessedduffield@gmail.com> | 2020-03-28 11:59:45 +1100 |
commit | 39315ca1e2f526911ea35d9848b0427093e4080a (patch) | |
tree | f9c49bf7ab7915734b8b8f6413e4439a394b6653 /pkg/gui/view_helpers.go | |
parent | efb51eee96331448d0b419ff9d981f11f22f7638 (diff) |
use wait groups when refreshing
Diffstat (limited to 'pkg/gui/view_helpers.go')
-rw-r--r-- | pkg/gui/view_helpers.go | 29 |
1 files changed, 22 insertions, 7 deletions
diff --git a/pkg/gui/view_helpers.go b/pkg/gui/view_helpers.go index 254abd044..831facb84 100644 --- a/pkg/gui/view_helpers.go +++ b/pkg/gui/view_helpers.go @@ -4,6 +4,7 @@ import ( "fmt" "sort" "strings" + "sync" "github.com/go-errors/errors" "github.com/jesseduffield/gocui" @@ -14,14 +15,28 @@ import ( var cyclableViews = []string{"status", "files", "branches", "commits", "stash"} func (gui *Gui) refreshSidePanels(g *gocui.Gui) error { - if err := gui.refreshCommits(g); err != nil { - return err - } - if err := gui.refreshFiles(); err != nil { - return err - } + wg := sync.WaitGroup{} + + wg.Add(3) - return gui.refreshStashEntries(g) + func() { + gui.refreshCommits(g) + wg.Done() + }() + + func() { + gui.refreshFiles() + wg.Done() + }() + + func() { + gui.refreshStashEntries(g) + wg.Done() + }() + + wg.Wait() + + return nil } func (gui *Gui) nextView(g *gocui.Gui, v *gocui.View) error { |