From 949d10f2995199e549c6e5045266912f85b467d9 Mon Sep 17 00:00:00 2001 From: Tan Jiang Date: Tue, 28 Jun 2016 18:08:39 +0800 Subject: [PATCH] do not scan for tags while refreshing cache --- service/utils/cache.go | 39 ++++++++++++++++++++------------------- 1 file changed, 20 insertions(+), 19 deletions(-) diff --git a/service/utils/cache.go b/service/utils/cache.go index a19753f59..27a8cc8b5 100644 --- a/service/utils/cache.go +++ b/service/utils/cache.go @@ -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 }