Skip to content

Commit

Permalink
[deploy/env] check for errors after mutex lock, fixes #9
Browse files Browse the repository at this point in the history
  • Loading branch information
maorfr committed Dec 17, 2018
1 parent 6f657c3 commit 5bdd1ca
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions pkg/utils/helm.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,20 +53,20 @@ func DeployChartsFromRepository(o DeployChartsFromRepositoryOptions) error {
go func(r ReleaseSpec) {
defer bwg.Done()

// If there has been an error in a concurrent deployment - don`t deploy anymore
if len(errc) != 0 {
return
}

// If there are (still) any dependencies - leave this chart for a later iteration
if len(r.Dependencies) != 0 {
return
}

mutex.Lock()
// If there has been an error in a concurrent deployment - don`t deploy anymore
if len(errc) != 0 {
mutex.Unlock()
return
}
// Find index of chart in slice
// may have changed by now since we are using go routines
// If chart was not found - another routine is taking care of it
mutex.Lock()
index := GetChartIndex(releasesToInstall, r.ChartName)
if index == -1 {
mutex.Unlock()
Expand Down

0 comments on commit 5bdd1ca

Please sign in to comment.