feature(tag) add a thread pool for tag list

Signed-off-by: Ziming Zhang <zziming@vmware.com>
This commit is contained in:
Ziming Zhang 2020-09-25 19:34:46 +08:00 committed by Ziming
parent b5a4ebacd6
commit a01a0c1b94

View File

@ -649,6 +649,7 @@ func assembleTagsInParallel(client *registry.Repository, projectID int64, reposi
}
}
limit := make(chan bool, 100)
c := make(chan *models.TagResp)
for _, tag := range tags {
go assembleTag(
@ -659,6 +660,7 @@ func assembleTagsInParallel(client *registry.Repository, projectID int64, reposi
tag,
config.WithNotary(),
signatures,
limit,
)
}
result := []*models.TagResp{}
@ -675,7 +677,9 @@ func assembleTagsInParallel(client *registry.Repository, projectID int64, reposi
func assembleTag(c chan *models.TagResp, client *registry.Repository, projectID int64,
repository, tag string, notaryEnabled bool,
signatures map[string][]notarymodel.Target) {
signatures map[string][]notarymodel.Target, limit chan bool) {
limit <- true
defer func() { <-limit }()
item := &models.TagResp{}
// labels
image := fmt.Sprintf("%s:%s", repository, tag)