瀏覽代碼

builder: fix cancellation context issue

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Tonis Tiigi 7 年之前
父節點
當前提交
2567dd9afc
共有 1 個文件被更改,包括 2 次插入1 次删除
  1. 2 1
      builder/builder-next/builder.go

+ 2 - 1
builder/builder-next/builder.go

@@ -137,7 +137,8 @@ func (b *Builder) Build(ctx context.Context, opt backend.BuildConfig) (*builder.
 			b.jobs[buildID] = newBuildJob()
 			b.jobs[buildID] = newBuildJob()
 		}
 		}
 		j := b.jobs[buildID]
 		j := b.jobs[buildID]
-		ctx, cancel := context.WithCancel(ctx)
+		var cancel func()
+		ctx, cancel = context.WithCancel(ctx)
 		j.cancel = cancel
 		j.cancel = cancel
 		b.mu.Unlock()
 		b.mu.Unlock()