use temporary map to prevent UI disruption during tags calculation

This commit is contained in:
Jan He 2021-12-21 17:44:50 +01:00
parent 19d15065ed
commit 3e869fd54b
No known key found for this signature in database
GPG Key ID: EA7F4C057861600B

View File

@ -179,10 +179,11 @@ func (c *Client) Repositories(useCache bool) map[string][]string {
linkRegexp := regexp.MustCompile("^<(.*?)>;.*$")
scope := "registry:catalog:*"
uri := "/v2/_catalog"
c.repos = map[string][]string{}
tmp := map[string][]string{}
for {
data, resp := c.callRegistry(uri, scope, "manifest.v2")
if data == "" {
c.repos = tmp
return c.repos
}
@ -194,7 +195,7 @@ func (c *Client) Repositories(useCache bool) map[string][]string {
namespace = f[0]
repo = f[1]
}
c.repos[namespace] = append(c.repos[namespace], repo)
tmp[namespace] = append(tmp[namespace], repo)
}
// pagination
@ -208,6 +209,7 @@ func (c *Client) Repositories(useCache bool) map[string][]string {
break
}
}
c.repos = tmp
return c.repos
}