Skip to content

Commit

Permalink
Merge pull request #4 from hortonworks/CB-12968
Browse files Browse the repository at this point in the history
CB-12968 Fix error handling deadlock
  • Loading branch information
Bajzathd authored Jun 9, 2021
2 parents 1852067 + d004f8a commit 27f0aec
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ func main() {

wg := &sync.WaitGroup{}
wg.Add(len(tasks))
errChan := make(chan error)
errChan := make(chan error, len(tasks))

log.Println("Getting blob sizes..")
for storageAccount, cmd := range tasks {
Expand Down Expand Up @@ -117,14 +117,12 @@ func main() {
}(storageAccount, cmd)
}

go func() {
wg.Wait()
close(errChan)
}()
wg.Wait()
close(errChan)

if len(errChan) != 0 {
for err := range errChan {
log.Printf("%w", err)
log.Printf("%s", err.Error())
}
panic("Failed to poll progress of some copy operations")
}
Expand Down

0 comments on commit 27f0aec

Please sign in to comment.