Skip to content

Commit

Permalink
Merge pull request #5227 from tonistiigi/grpc-stream-close
Browse files Browse the repository at this point in the history
contentproxy: ensure grpc stream is closed on commit
  • Loading branch information
estesp committed Mar 19, 2021
2 parents fbf7954 + 8d8c15c commit 86a7db4
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion content/proxy/content_writer.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,14 @@ func (rw *remoteWriter) Write(p []byte) (n int, err error) {
return
}

func (rw *remoteWriter) Commit(ctx context.Context, size int64, expected digest.Digest, opts ...content.Opt) error {
func (rw *remoteWriter) Commit(ctx context.Context, size int64, expected digest.Digest, opts ...content.Opt) (err error) {
defer func() {
err1 := rw.Close()
if err == nil {
err = err1
}
}()

var base content.Info
for _, opt := range opts {
if err := opt(&base); err != nil {
Expand Down

0 comments on commit 86a7db4

Please sign in to comment.