Skip to content

Commit

Permalink
Now failed goroutines will restart
Browse files Browse the repository at this point in the history
  • Loading branch information
Matheus Pimenta committed Aug 19, 2019
1 parent c3adb60 commit 17341e2
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions cmd/loadtest.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,21 @@ You can use environment variables to override configuration keys.`,
log.E(l, "Goroutine exited with error.", func(cm log.CM) {
cm.Write(zap.String("error", err.Error()))
})
exitChannel <- false
} else {
log.I(l, "Goroutine exited without errors.")
exitChannel <- true
}

exitChannel <- true
}
for i := 0; i < nGoroutines; i++ {
go routine()
}
for i := 0; i < nGoroutines; i++ {
<-exitChannel
for i := 0; i < nGoroutines; {
if ok := <-exitChannel; ok {
i++
} else {
go routine()
}
}

l := logger.With(
Expand Down

0 comments on commit 17341e2

Please sign in to comment.