浏览代码

Merge pull request #37597 from tiborvass/fix-cancel-bug

builder: do not cancel buildkit status request
Akihiro Suda 7 年之前
父节点
当前提交
080c27dd13
共有 1 个文件被更改,包括 4 次插入3 次删除
  1. 4 3
      builder/builder-next/builder.go

+ 4 - 3
builder/builder-next/builder.go

@@ -258,9 +258,10 @@ func (b *Builder) Build(ctx context.Context, opt backend.BuildConfig) (*builder.
 
 	eg.Go(func() error {
 		defer close(ch)
-		return b.controller.Status(&controlapi.StatusRequest{
-			Ref: id,
-		}, &statusProxy{streamProxy: streamProxy{ctx: ctx}, ch: ch})
+		// streamProxy.ctx is not set to ctx because when request is cancelled,
+		// only the build request has to be cancelled, not the status request.
+		stream := &statusProxy{streamProxy: streamProxy{ctx: context.TODO()}, ch: ch}
+		return b.controller.Status(&controlapi.StatusRequest{Ref: id}, stream)
 	})
 
 	eg.Go(func() error {