MCPcopy Create free account
hub / github.com/temporalio/temporal / fetchCommitMetasParallel

Function fetchCommitMetasParallel

tools/flakereport/bisect.go:479–506  ·  view source on GitHub ↗

fetchCommitMetasParallel fetches commit metadata for a list of SHAs concurrently, bounded by maxConcurrency. Returns an immutable map of SHA → CommitMeta; failed fetches are logged and omitted (heuristic priors fall back to 1.0).

(ctx context.Context, repo string, shas []string, maxConcurrency int)

Source from the content-addressed store, hash-verified

477// bounded by maxConcurrency. Returns an immutable map of SHA → CommitMeta; failed
478// fetches are logged and omitted (heuristic priors fall back to 1.0).
479func fetchCommitMetasParallel(ctx context.Context, repo string, shas []string, maxConcurrency int) map[string]CommitMeta {
480 metas := make([]CommitMeta, len(shas))
481 ok := make([]bool, len(shas))
482
483 g, ctx := errgroup.WithContext(ctx)
484 g.SetLimit(maxConcurrency)
485 for i, sha := range shas {
486 g.Go(func() error {
487 meta, err := fetchCommitMeta(ctx, repo, sha)
488 if err != nil {
489 fmt.Printf("Warning: failed to fetch metadata for commit %s: %v\n", sha[:7], err)
490 return nil
491 }
492 metas[i] = meta
493 ok[i] = true
494 return nil
495 })
496 }
497 _ = g.Wait()
498
499 commitMetas := make(map[string]CommitMeta, len(shas))
500 for i, sha := range shas {
501 if ok[i] {
502 commitMetas[sha] = metas[i]
503 }
504 }
505 return commitMetas
506}

Callers 1

runBisectAnalysisFunction · 0.85

Calls 5

fetchCommitMetaFunction · 0.85
WithContextMethod · 0.65
WaitMethod · 0.65
GoMethod · 0.45
PrintfMethod · 0.45

Tested by

no test coverage detected