fix: use finer-grained locking when listing releases for diff (#1343)
`isReleaseInstalled` will call `helm list` which can take a bit of time. in order to allow parallelism, we need to use a finer mutex lock. Signed-off-by: Steven Davidovitz <steven.davidovitz@dominodatalab.com>
This commit is contained in:
parent
99a4d8b62f
commit
a027b23698
|
|
@ -1772,16 +1772,17 @@ func (st *HelmState) prepareDiffReleases(helm helmexec.Interface, additionalValu
|
|||
o.Apply(opt)
|
||||
}
|
||||
|
||||
mu := &sync.Mutex{}
|
||||
mu := &sync.RWMutex{}
|
||||
installedReleases := map[string]bool{}
|
||||
|
||||
isInstalled := func(r *ReleaseSpec) bool {
|
||||
mu.Lock()
|
||||
defer mu.Unlock()
|
||||
|
||||
id := ReleaseToID(r)
|
||||
|
||||
if v, ok := installedReleases[id]; ok {
|
||||
mu.RLock()
|
||||
v, ok := installedReleases[id]
|
||||
mu.RUnlock()
|
||||
|
||||
if ok {
|
||||
return v
|
||||
}
|
||||
|
||||
|
|
@ -1789,7 +1790,9 @@ func (st *HelmState) prepareDiffReleases(helm helmexec.Interface, additionalValu
|
|||
if err != nil {
|
||||
st.logger.Warnf("confirming if the release is already installed or not: %v", err)
|
||||
} else {
|
||||
mu.Lock()
|
||||
installedReleases[id] = v
|
||||
mu.Unlock()
|
||||
}
|
||||
|
||||
return v
|
||||
|
|
|
|||
Loading…
Reference in New Issue