Skip to content

Commit

Permalink
Merge pull request #11 from KlassnayaAfrodita/patch-2
Browse files Browse the repository at this point in the history
Update concurrency.go
  • Loading branch information
hokamsingh authored Oct 11, 2024
2 parents d9b95fd + c2ff575 commit 710e53d
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion internal/core/concurrency/concurrency.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,12 @@ func (tm *TaskManager) runParallel(ctx context.Context) ([]interface{}, error) {
// Submit tasks to the worker pool
for i, task := range tm.tasks {
go func(index int, task *Task) {
pool.Submit(task, index)
select {
case <-ctx.Done():
errChan <- ctx.Err()
default:
pool.Submit(task, index)
}
}(i, task)
}

Expand Down

0 comments on commit 710e53d

Please sign in to comment.