From deed9db694d8bf06cbd80a10a2debc3ab6452518 Mon Sep 17 00:00:00 2001 From: Yadong Ding Date: Sat, 19 Aug 2023 22:24:38 +0800 Subject: [PATCH] fix: update lease in commit To make leaseCache is synchronized with local storage before read each blob. Signed-off-by: Yadong Ding --- pkg/content/content.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pkg/content/content.go b/pkg/content/content.go index 5759133b..7f0d3126 100644 --- a/pkg/content/content.go +++ b/pkg/content/content.go @@ -268,15 +268,17 @@ func (content *Content) Abort(ctx context.Context, ref string) error { func (content *Content) Writer(ctx context.Context, opts ...content.WriterOpt) (content.Writer, error) { writer, err := content.store.Writer(ctx, opts...) - return &localWriter{writer}, err + return &localWriter{writer, content}, err } // localWriter wrap the content.Writer type localWriter struct { content.Writer + content *Content } func (localWriter localWriter) Commit(ctx context.Context, size int64, expected digest.Digest, opts ...content.Opt) error { // we don't write any lables, drop the opts + localWriter.content.updateLease(&expected) return localWriter.Writer.Commit(ctx, size, expected) }