From 905e8f793bdaa2d8c4ea244b294c11f63d5eda0e Mon Sep 17 00:00:00 2001 From: jonny08152 Date: Wed, 22 Dec 2021 10:07:31 +0100 Subject: [PATCH] use temporary map to prevent UI disruption during tags calculation (#60) --- registry/client.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/registry/client.go b/registry/client.go index 03cc38f..e9a50a7 100644 --- a/registry/client.go +++ b/registry/client.go @@ -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 }