Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
fix(parallel): cancel context for active tasks when task fails (#5800)
Signed-off-by: Aleksei Igrychev <aleksei.igrychev@palark.com>
  • Loading branch information
alexey-igrychev committed Sep 25, 2023
1 parent 83137b2 commit 1d062fd
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pkg/util/parallel/parallel.go
Expand Up @@ -25,6 +25,9 @@ func DoTasks(ctx context.Context, numberOfTasks int, options DoTasksOptions, tas
return nil
}

ctx, cancelCtx := context.WithCancel(ctx)
defer cancelCtx()

// determine number of tasks
numberOfWorkers := options.MaxNumberOfWorkers
if numberOfWorkers <= 0 || numberOfWorkers > numberOfTasks {
Expand Down

0 comments on commit 1d062fd

Please sign in to comment.