diff --git a/cli/internal/run/dry_run.go b/cli/internal/run/dry_run.go index 1e15c5b824b76a..1d4d74e069b5c1 100644 --- a/cli/internal/run/dry_run.go +++ b/cli/internal/run/dry_run.go @@ -50,13 +50,13 @@ func DryRun( return err } - // Assign the Task Summaries to the main summary - summary.Tasks = taskSummaries - // We walk the graph with no concurrency. // Populating the cache state is parallelizable. // Do this _after_ walking the graph. - summary.PopulateCacheState(turboCache) + populateCacheState(turboCache, taskSummaries) + + // Assign the Task Summaries to the main summary + summary.Tasks = taskSummaries // Render the dry run as json if dryRunJSON { diff --git a/cli/internal/run/real_run.go b/cli/internal/run/real_run.go index 08c697fdbecc11..d7706bbb38d31c 100644 --- a/cli/internal/run/real_run.go +++ b/cli/internal/run/real_run.go @@ -123,11 +123,6 @@ func RealRun( // Assign tasks after execution runSummary.Tasks = taskSummaries - // We walk the graph with no concurrency. - // Populating the cache state is parallelizable. - // Do this _after_ walking the graph. - runSummary.PopulateCacheState(turboCache) - for _, err := range errs { if errors.As(err, &exitCodeErr) { if exitCodeErr.ExitCode > exitCode { diff --git a/cli/internal/runsummary/run_summary.go b/cli/internal/runsummary/run_summary.go index d9ce6096636efc..6d38e526141b29 100644 --- a/cli/internal/runsummary/run_summary.go +++ b/cli/internal/runsummary/run_summary.go @@ -4,7 +4,6 @@ package runsummary import ( "fmt" "path/filepath" - "sync" "time" "github.com/mitchellh/cli" @@ -47,40 +46,6 @@ func NewRunSummary(startAt time.Time, profile string, turboVersion string, packa } } -// PopulateCacheState sets the CacheState field on each of the TaskSummaries -func (summary *RunSummary) PopulateCacheState(turboCache cache.Cache) { - taskSummaries := summary.Tasks - // We make at most 8 requests at a time for cache state. - maxParallelRequests := 8 - taskCount := len(taskSummaries) - - parallelRequestCount := maxParallelRequests - if taskCount < maxParallelRequests { - parallelRequestCount = taskCount - } - - queue := make(chan int, taskCount) - - wg := &sync.WaitGroup{} - for i := 0; i < parallelRequestCount; i++ { - wg.Add(1) - go func() { - defer wg.Done() - for index := range queue { - task := taskSummaries[index] - itemStatus := turboCache.Exists(task.Hash) - task.CacheState = itemStatus - } - }() - } - - for index := range taskSummaries { - queue <- index - } - close(queue) - wg.Wait() -} - // Close wraps up the RunSummary at the end of a `turbo run`. func (summary *RunSummary) Close(terminal cli.Ui) { if err := writeChrometracing(summary.ExecutionSummary.profileFilename, terminal); err != nil {