Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update ComponentManifests simultaneously when tiup list #1532

Merged
merged 2 commits into from
Aug 23, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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