diff options
Diffstat (limited to 'd1pkgweb.go')
-rw-r--r-- | d1pkgweb.go | 27 |
1 files changed, 12 insertions, 15 deletions
diff --git a/d1pkgweb.go b/d1pkgweb.go index d78f004..4fde257 100644 --- a/d1pkgweb.go +++ b/d1pkgweb.go @@ -40,20 +40,19 @@ func processSuite(suiteCfg SuiteCfg, relCfg ReleaseCfg, baseDir string, result c func processRelease(relCfg ReleaseCfg, baseDir string, result chan error) { - c := make(chan error) + children := make(chan error) numWorkers := 0 - for _, suiteCfg := range relCfg.Suites { // For each suite of the release + for _, suiteCfg := range relCfg.Suites { // For each suite in the release, run a processSuite numWorkers++ - go processSuite(suiteCfg, relCfg, baseDir, c) + go processSuite(suiteCfg, relCfg, baseDir, children) } - select { - case e := <-c: + for { + <-children numWorkers-- if numWorkers == 0 { - result <- e - return + break } } result <- nil @@ -72,22 +71,20 @@ func main() { confFile := args[1] conf := readConfig(confFile) - c := make(chan error) + children := make(chan error) numWorkers := 0 - for _, relCfg := range conf.PkgSets { // For each release... + for _, relCfg := range conf.PkgSets { // For each release, run a new processRelease... numWorkers++ - go processRelease(relCfg, ".", c) + go processRelease(relCfg, ".", children) } - var err = make([]error, numWorkers) - select { - case e := <-c: + for { + <-children numWorkers-- - err[numWorkers] = e if numWorkers == 0 { fmt.Fprintf(os.Stderr, "Exiting from main....") - os.Exit(0) + break } } } |