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 { if err != nil {
return err return err
} }
/*
repos := []string{}
repos := []string{} for _, repo := range rs {
rc, ok := repositoryClients[repo]
for _, repo := range rs { if !ok {
rc, ok := repositoryClients[repo] rc, err = registry.NewRepositoryWithUsername(repo, endpoint, username)
if !ok { if err != nil {
rc, err = registry.NewRepositoryWithUsername(repo, endpoint, username) 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 { 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 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 { if len(tags) != 0 {
repos = append(repos, repo) repos = append(repos, repo)
log.Debugf("add %s to catalog cache", 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 return nil
} }