Skip to content

Commit e8ce87c

Browse files
committed
fix(backend): simplify close comment per review
Signed-off-by: say <say.apm35@gmail.com> Signed-off-by: Sai Asish Y <say.apm35@gmail.com>
1 parent d6c0c5c commit e8ce87c

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
@@ -186,12 +186,9 @@ func pushIfNotExist(ctx context.Context, pb *internalpb.ProgressBar, prompt stri
186186
if err != nil {
187187
return err
188188
}
189-
// The ReadCloser returned by PullBlob was previously never closed on
190-
// either path, leaking the underlying file descriptor (or HTTP body)
191-
// for every blob we pushed. Close on the distribution implementation
192-
// returns an error (#50), which is why we still wrap the reader with
193-
// io.NopCloser below, but we DO need to close `content` ourselves.
194-
// See #491.
189+
// Ensure the blob content is closed to avoid leaking resources (#491).
190+
// We use defer here and io.NopCloser below to work around the distribution
191+
// library's Close() implementation which returns a known error (#50).
195192
defer content.Close()
196193

197194
reader := pb.Add(prompt, desc.Digest.String(), desc.Size, tracker.WrapReader(content))

0 commit comments

Comments
 (0)