mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-05-13 22:17:05 +02:00
use wait groups when refreshing
This commit is contained in:
parent
efb51eee96
commit
39315ca1e2
@ -2,6 +2,7 @@ package gui
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"strconv"
|
"strconv"
|
||||||
|
"sync"
|
||||||
|
|
||||||
"github.com/jesseduffield/gocui"
|
"github.com/jesseduffield/gocui"
|
||||||
"github.com/jesseduffield/lazygit/pkg/commands"
|
"github.com/jesseduffield/lazygit/pkg/commands"
|
||||||
@ -75,15 +76,21 @@ func (gui *Gui) refreshCommits(g *gocui.Gui) error {
|
|||||||
return gui.createErrorPanel(gui.g, err.Error())
|
return gui.createErrorPanel(gui.g, err.Error())
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := gui.refreshCommitsWithLimit(); err != nil {
|
wg := sync.WaitGroup{}
|
||||||
return gui.createErrorPanel(gui.g, err.Error())
|
wg.Add(2)
|
||||||
}
|
|
||||||
|
|
||||||
if err := gui.refreshReflogCommits(); err != nil {
|
|
||||||
return gui.createErrorPanel(gui.g, err.Error())
|
|
||||||
}
|
|
||||||
|
|
||||||
|
go func() {
|
||||||
|
gui.refreshReflogCommits()
|
||||||
gui.refreshBranches()
|
gui.refreshBranches()
|
||||||
|
wg.Done()
|
||||||
|
}()
|
||||||
|
|
||||||
|
go func() {
|
||||||
|
gui.refreshCommitsWithLimit()
|
||||||
|
wg.Done()
|
||||||
|
}()
|
||||||
|
|
||||||
|
wg.Wait()
|
||||||
|
|
||||||
gui.refreshStatus()
|
gui.refreshStatus()
|
||||||
|
|
||||||
|
@ -4,6 +4,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"sort"
|
"sort"
|
||||||
"strings"
|
"strings"
|
||||||
|
"sync"
|
||||||
|
|
||||||
"github.com/go-errors/errors"
|
"github.com/go-errors/errors"
|
||||||
"github.com/jesseduffield/gocui"
|
"github.com/jesseduffield/gocui"
|
||||||
@ -14,14 +15,28 @@ import (
|
|||||||
var cyclableViews = []string{"status", "files", "branches", "commits", "stash"}
|
var cyclableViews = []string{"status", "files", "branches", "commits", "stash"}
|
||||||
|
|
||||||
func (gui *Gui) refreshSidePanels(g *gocui.Gui) error {
|
func (gui *Gui) refreshSidePanels(g *gocui.Gui) error {
|
||||||
if err := gui.refreshCommits(g); err != nil {
|
wg := sync.WaitGroup{}
|
||||||
return err
|
|
||||||
}
|
|
||||||
if err := gui.refreshFiles(); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
return gui.refreshStashEntries(g)
|
wg.Add(3)
|
||||||
|
|
||||||
|
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 {
|
func (gui *Gui) nextView(g *gocui.Gui, v *gocui.View) error {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user