mirror of
https://github.com/goharbor/harbor.git
synced 2024-11-19 08:45:27 +01:00
merge with master
This commit is contained in:
commit
523eacef86
13
service/cache/cache.go
vendored
13
service/cache/cache.go
vendored
@ -60,17 +60,19 @@ func RefreshCatalogCache() error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
repos := []string{}
|
repos := []string{}
|
||||||
|
|
||||||
for _, repo := range rs {
|
for _, repo := range rs {
|
||||||
rc, err := NewRepositoryClient(endpoint, true, username,
|
rc, ok := repositoryClients[repo]
|
||||||
repo, "repository", repo, "pull", "push", "*")
|
if !ok {
|
||||||
|
rc, err = registry.NewRepositoryWithUsername(repo, endpoint, username)
|
||||||
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 initializing repository client used by cache: %s %v", repo, err)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
repositoryClients[repo] = rc
|
||||||
|
}
|
||||||
tags, err := rc.ListTag()
|
tags, err := rc.ListTag()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Errorf("error occurred while list tag for %s: %v", repo, err)
|
log.Errorf("error occurred while list tag for %s: %v", repo, err)
|
||||||
@ -82,8 +84,9 @@ func RefreshCatalogCache() error {
|
|||||||
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
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user