Skip to content

Commit

Permalink
update ComponentManifests simultaneously when tiup list (#1532)
Browse files Browse the repository at this point in the history
  • Loading branch information
nexustar authored Aug 23, 2021
1 parent 74b96e0 commit 15d5997
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions pkg/repository/v1_repository.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ import (
"github.com/pingcap/tiup/pkg/repository/v1manifest"
"github.com/pingcap/tiup/pkg/utils"
"golang.org/x/mod/semver"
"golang.org/x/sync/errgroup"
)

// ErrUnknownComponent represents the specific component cannot be found in index.json
Expand Down Expand Up @@ -703,11 +704,18 @@ func (r *V1Repository) UpdateComponentManifests() error {
return err
}

var g errgroup.Group
for name := range index.Components {
_, err = r.updateComponentManifest(name, false)
if err != nil && errors.Cause(err) != ErrUnknownComponent {
name := name
g.Go(func() error {
_, err = r.updateComponentManifest(name, false)
return err
}
})
}

err = g.Wait()
if err != nil && errors.Cause(err) != ErrUnknownComponent {
return err
}

return nil
Expand Down

0 comments on commit 15d5997

Please sign in to comment.