Skip to content

Commit 65d271c

Browse files
committed
fix(backend): simplify close comment per review
Signed-off-by: say <say.apm35@gmail.com>
1 parent 5f210e1 commit 65d271c

1 file changed

Lines changed: 3 additions & 6 deletions

File tree

pkg/backend/push.go

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -176,12 +176,9 @@ func pushIfNotExist(ctx context.Context, pb *internalpb.ProgressBar, prompt stri
176176
if err != nil {
177177
return err
178178
}
179-
// The ReadCloser returned by PullBlob was previously never closed on
180-
// either path, leaking the underlying file descriptor (or HTTP body)
181-
// for every blob we pushed. Close on the distribution implementation
182-
// returns an error (#50), which is why we still wrap the reader with
183-
// io.NopCloser below, but we DO need to close `content` ourselves.
184-
// See #491.
179+
// Ensure the blob content is closed to avoid leaking resources (#491).
180+
// We use defer here and io.NopCloser below to work around the distribution
181+
// library's Close() implementation which returns a known error (#50).
185182
defer content.Close()
186183

187184
reader := pb.Add(prompt, desc.Digest.String(), desc.Size, content)

0 commit comments

Comments
 (0)