Improve cache load by a shitload
This commit is contained in:
@ -146,7 +146,6 @@ func (c *Cache) LoadProjects() {
|
||||
|
||||
defer pBar.Stop()
|
||||
|
||||
var curProjects int
|
||||
for {
|
||||
select {
|
||||
case p := <-progressInfo.ProgressChan:
|
||||
@ -157,8 +156,7 @@ func (c *Cache) LoadProjects() {
|
||||
// This sucks, has to be a better way, and why is the logger incompatible
|
||||
// with the progressbar?
|
||||
pterm.Debug.Println(fmt.Sprintf("Update received: %#v", p))
|
||||
pBar.Add(p.Projects - curProjects)
|
||||
curProjects = p.Projects
|
||||
pBar.Add(p.Projects)
|
||||
case p := <-progressInfo.ProjectsChan:
|
||||
c.Projects = append(c.Projects, p...)
|
||||
case e := <-progressInfo.ErrorChan:
|
||||
@ -167,7 +165,7 @@ func (c *Cache) LoadProjects() {
|
||||
c.log.Warn("LoadProjects cancelled", c.log.Args("reason", c.gitlab.Ctx.Err()))
|
||||
return
|
||||
case <-progressInfo.DoneChan:
|
||||
pBar.Add(pBar.Total - curProjects)
|
||||
// pBar.Add(pBar.Total - curProjects)
|
||||
fmt.Println("")
|
||||
c.log.Info("Project load complete")
|
||||
return
|
||||
|
Reference in New Issue
Block a user