From f5069231321fc278e56f975fc3f41d627f2c227c Mon Sep 17 00:00:00 2001 From: "stonezdj(Daojun Zhang)" Date: Thu, 8 Dec 2022 13:50:37 +0800 Subject: [PATCH] Update the log information in proxy cache (#17936) fixes #17933 Signed-off-by: stonezdj Signed-off-by: stonezdj --- src/pkg/p2p/preheat/provider/dragonfly.go | 2 +- src/server/middleware/repoproxy/proxy.go | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/pkg/p2p/preheat/provider/dragonfly.go b/src/pkg/p2p/preheat/provider/dragonfly.go index c0b87373351..9df951730b2 100644 --- a/src/pkg/p2p/preheat/provider/dragonfly.go +++ b/src/pkg/p2p/preheat/provider/dragonfly.go @@ -117,7 +117,7 @@ func (dd *DragonflyDriver) CheckProgress(taskID string) (*PreheatingStatus, erro } // If preheat job already exists - if strings.Index(status.ErrorMsg, "preheat task already exists, id:") >= 0 { + if strings.Contains(status.ErrorMsg, "preheat task already exists, id:") { if taskID, err = getTaskExistedFromErrMsg(status.ErrorMsg); err != nil { return nil, err } diff --git a/src/server/middleware/repoproxy/proxy.go b/src/server/middleware/repoproxy/proxy.go index 8b94f2ba285..1263ddaee5c 100644 --- a/src/server/middleware/repoproxy/proxy.go +++ b/src/server/middleware/repoproxy/proxy.go @@ -194,12 +194,11 @@ func handleManifest(w http.ResponseWriter, r *http.Request, next http.Handler) e return nil } - log.Warningf("Artifact: %v:%v, digest:%v is not found in proxy cache, fetch it from remote repo", art.Repository, art.Tag, art.Digest) - log.Debugf("the tag is %v, digest is %v", art.Tag, art.Digest) if r.Method == http.MethodHead { err = proxyManifestHead(ctx, w, proxyCtl, p, art, remote) } else if r.Method == http.MethodGet { + log.Warningf("Artifact: %v:%v, digest:%v is not found in proxy cache, fetch it from remote repo", art.Repository, art.Tag, art.Digest) err = proxyManifestGet(ctx, w, proxyCtl, p, art, remote) } if err != nil {