Skip to content

Commit

Permalink
Merge pull request #42 from dalmarcogd/feature/issue30
Browse files Browse the repository at this point in the history
feature of timeout, deadline and changed setup worker
  • Loading branch information
dalmarcogd authored May 12, 2020
2 parents 6adf3f9 + 60d7e90 commit 9008180
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions worker/worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,10 @@ func RunWorkers(workers []*Worker, handleError func(w *Worker, err error)) error
errors := make(chan WrapperHandleError, worker.Concurrency)

wg.Add(2)
go func() {
go func(w *Worker) {
defer wg.Done()
runWorker(worker, errors)
}()
runWorker(w, errors)
}(worker)
go func(w *Worker) {
defer wg.Done()
runWorkerHandleError(handleError, w, errors)
Expand Down Expand Up @@ -159,10 +159,10 @@ func runWorkerHandleError(handleError func(w *Worker, err error), worker *Worker
for err := range errors {
if handleError != nil {
done := make(chan bool, 1)
go func() {
handleError(err.subWorker.Worker, err.err)
go func(e WrapperHandleError) {
handleError(e.subWorker.Worker, e.err)
done <- true
}()
}(err)

select {
case <-time.After(10 * time.Second):
Expand Down

0 comments on commit 9008180

Please sign in to comment.