MCPcopy Index your code
hub / github.com/cli/cli / ConcurrentUpload

Function ConcurrentUpload

pkg/cmd/release/shared/upload.go:114–131  ·  view source on GitHub ↗
(httpClient httpDoer, uploadURL string, numWorkers int, assets []*AssetForUpload)

Source from the content-addressed store, hash-verified

112}
113
114func ConcurrentUpload(httpClient httpDoer, uploadURL string, numWorkers int, assets []*AssetForUpload) error {
115 if numWorkers == 0 {
116 return errors.New("the number of concurrent workers needs to be greater than 0")
117 }
118
119 ctx := context.Background()
120 g, gctx := errgroup.WithContext(ctx)
121 g.SetLimit(numWorkers)
122
123 for _, a := range assets {
124 asset := *a
125 g.Go(func() error {
126 return uploadWithDelete(gctx, httpClient, uploadURL, asset)
127 })
128 }
129
130 return g.Wait()
131}
132
133func shouldRetry(err error) bool {
134 var networkError errNetwork

Callers 2

uploadRunFunction · 0.92
createRunFunction · 0.92

Calls 2

uploadWithDeleteFunction · 0.85
WaitMethod · 0.65

Tested by

no test coverage detected