Remove the delete local manifest when remote doesn't exist (#20597)

Previous impl it calls c.local.DeleteManifest(remoteRepo, art.Tag), because the remoteRepo is incorrect repository and it always delete nothing, to keep consistency with the previous version and code clarity, remove this go routine

Signed-off-by: stonezdj <stone.zhang@broadcom.com>
This commit is contained in:
stonezdj(Daojun Zhang) 2024-06-17 15:02:58 +08:00 committed by GitHub
parent e960711579
commit 793dc54aec
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -172,9 +172,6 @@ func (c *controller) UseLocalManifest(ctx context.Context, art lib.ArtifactInfo,
return false, nil, err return false, nil, err
} }
if !exist || desc == nil { if !exist || desc == nil {
go func() {
c.local.DeleteManifest(remoteRepo, art.Tag)
}()
return false, nil, errors.NotFoundError(fmt.Errorf("repo %v, tag %v not found", art.Repository, art.Tag)) return false, nil, errors.NotFoundError(fmt.Errorf("repo %v, tag %v not found", art.Repository, art.Tag))
} }
@ -220,11 +217,6 @@ func (c *controller) ProxyManifest(ctx context.Context, art lib.ArtifactInfo, re
ref := getReference(art) ref := getReference(art)
man, dig, err := remote.Manifest(remoteRepo, ref) man, dig, err := remote.Manifest(remoteRepo, ref)
if err != nil { if err != nil {
if errors.IsNotFoundErr(err) {
go func() {
c.local.DeleteManifest(remoteRepo, art.Tag)
}()
}
return man, err return man, err
} }
ct, _, err := man.Payload() ct, _, err := man.Payload()