diff options
author | Jesse Duffield <jessedduffield@gmail.com> | 2020-10-07 21:19:38 +1100 |
---|---|---|
committer | Jesse Duffield <jessedduffield@gmail.com> | 2020-10-10 00:23:01 +1100 |
commit | 79e59d5460d838203bc79ac86c0ba529305ba2a9 (patch) | |
tree | 7a7d6c48440f02945599606494ac64424d274f58 /pkg/gui/commits_panel.go | |
parent | ba4c3e5bc475a7819fd954985105073ba239bf9e (diff) |
add some safe goroutines
WIP
Diffstat (limited to 'pkg/gui/commits_panel.go')
-rw-r--r-- | pkg/gui/commits_panel.go | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/pkg/gui/commits_panel.go b/pkg/gui/commits_panel.go index cc969c0c1..b5803a6a0 100644 --- a/pkg/gui/commits_panel.go +++ b/pkg/gui/commits_panel.go @@ -24,11 +24,11 @@ func (gui *Gui) handleCommitSelect() error { state := gui.State.Panels.Commits if state.SelectedLineIdx > 290 && state.LimitCommits { state.LimitCommits = false - go func() { + go utils.Safe(func() { if err := gui.refreshCommitsWithLimit(); err != nil { _ = gui.surfaceError(err) } - }() + }) } gui.escapeLineByLinePanel() @@ -60,11 +60,11 @@ func (gui *Gui) handleCommitSelect() error { func (gui *Gui) refreshReflogCommitsConsideringStartup() { switch gui.State.StartupStage { case INITIAL: - go func() { + go utils.Safe(func() { _ = gui.refreshReflogCommits() gui.refreshBranches() gui.State.StartupStage = COMPLETE - }() + }) case COMPLETE: _ = gui.refreshReflogCommits() @@ -78,14 +78,14 @@ func (gui *Gui) refreshCommits() error { wg := sync.WaitGroup{} wg.Add(2) - go func() { + go utils.Safe(func() { gui.refreshReflogCommitsConsideringStartup() gui.refreshBranches() wg.Done() - }() + }) - go func() { + go utils.Safe(func() { _ = gui.refreshCommitsWithLimit() context, ok := gui.Contexts.CommitFiles.Context.GetParentContext() if ok && context.GetKey() == BRANCH_COMMITS_CONTEXT_KEY { @@ -102,7 +102,7 @@ func (gui *Gui) refreshCommits() error { } } wg.Done() - }() + }) wg.Wait() |