mirror of
https://github.com/moby/buildkit.git
synced 2026-11-06 05:16:45 +00:00
fix(solver): check for context canceled in ReleaseUnreferenced
The existing implementations do not check for the context being canceled when `ReleaseUnreferenced` is called which has caused a bug in how the controller invokes `ReleaseUnreferenced` to be uncaught. We pass an already canceled context to the method which causes any implementations that do check the context to always fail. Signed-off-by: Jonathan A. Sternberg <jonathan.sternberg@docker.com>
This commit is contained in:
1 file changed
+3
-2
+3
-2
@@ -245,7 +245,8 @@ func (c *Controller) Prune(req *controlapi.PruneRequest, stream controlapi.Contr
|
||||
|
||||
ch := make(chan client.UsageInfo, 32)
|
||||
|
||||
eg, ctx := errgroup.WithContext(stream.Context())
|
||||
ctx := stream.Context()
|
||||
eg, ectx := errgroup.WithContext(ctx)
|
||||
workers, err := c.opt.WorkerController.List()
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "failed to list workers for prune")
|
||||
@@ -267,7 +268,7 @@ func (c *Controller) Prune(req *controlapi.PruneRequest, stream controlapi.Contr
|
||||
for _, w := range workers {
|
||||
func(w worker.Worker) {
|
||||
eg.Go(func() error {
|
||||
return w.Prune(ctx, ch, client.PruneInfo{
|
||||
return w.Prune(ectx, ch, client.PruneInfo{
|
||||
Filter: req.Filter,
|
||||
All: req.All,
|
||||
KeepDuration: time.Duration(req.KeepDuration),
|
||||
|
||||
Reference in new issue
Block a user