Merge pull request #434 from reasonerjt/master

do not scan for tags while refreshing cache
This commit is contained in:
Daniel Jiang 2016-06-28 18:23:23 +08:00 committed by GitHub
commit af1db227d9

View File

@ -66,32 +66,33 @@ func RefreshCatalogCache() error {
if err != nil {
return err
}
/*
repos := []string{}
repos := []string{}
for _, repo := range rs {
rc, ok := repositoryClients[repo]
if !ok {
rc, err = registry.NewRepositoryWithUsername(repo, endpoint, username)
for _, repo := range rs {
rc, ok := repositoryClients[repo]
if !ok {
rc, err = registry.NewRepositoryWithUsername(repo, endpoint, username)
if err != nil {
log.Errorf("error occurred while initializing repository client used by cache: %s %v", repo, err)
continue
}
repositoryClients[repo] = rc
}
tags, err := rc.ListTag()
if err != nil {
log.Errorf("error occurred while initializing repository client used by cache: %s %v", repo, err)
log.Errorf("error occurred while list tag for %s: %v", repo, err)
continue
}
repositoryClients[repo] = rc
}
tags, err := rc.ListTag()
if err != nil {
log.Errorf("error occurred while list tag for %s: %v", repo, err)
continue
}
if len(tags) != 0 {
repos = append(repos, repo)
log.Debugf("add %s to catalog cache", repo)
if len(tags) != 0 {
repos = append(repos, repo)
log.Debugf("add %s to catalog cache", repo)
}
}
}
*/
Cache.Put(catalogKey, repos, 600*time.Second)
Cache.Put(catalogKey, rs, 600*time.Second)
return nil
}