diff --git a/cache/repo_cache.go b/cache/repo_cache.go index 9e45d1f197730efc8bcffbe5a46645a8152a51ca..19b6e266001bceee6661efef1a76b236855b09a2 100644 --- a/cache/repo_cache.go +++ b/cache/repo_cache.go @@ -210,10 +210,15 @@ type BuildEventType int const ( _ BuildEventType = iota + // BuildEventCacheIsBuilt signal that the cache is being built (aka, not skipped) BuildEventCacheIsBuilt + // BuildEventRemoveLock signal that an old repo lock has been cleaned BuildEventRemoveLock + // BuildEventStarted signal the beginning of a cache build for an entity BuildEventStarted + // BuildEventProgress signal progress in the cache building for an entity BuildEventProgress + // BuildEventFinished signal the end of a cache build for an entity BuildEventFinished ) diff --git a/commands/execenv/loading.go b/commands/execenv/loading.go index 2263f70099af3af6cc7325c49460494068598a81..7838ea6a21001bc5e8d1ca710560e7909c9bc7c6 100644 --- a/commands/execenv/loading.go +++ b/commands/execenv/loading.go @@ -156,13 +156,17 @@ func CacheBuildProgressBar(env *Env, events chan cache.BuildEvent) error { mpb.AppendDecorators(decor.Percentage(decor.WCSyncSpace)), ) case cache.BuildEventProgress: - bars[event.Typename].SetTotal(event.Total, false) bars[event.Typename].SetCurrent(event.Progress) + bars[event.Typename].SetTotal(event.Total, event.Progress == event.Total) + case cache.BuildEventFinished: + if bar := bars[event.Typename]; !bar.Completed() { + bar.SetTotal(0, true) + } } } if progress != nil { - progress.Shutdown() + progress.Wait() } return nil