fix concurrency issue (#742)
Signed-off-by: yxxhero <aiopsclub@163.com>
This commit is contained in:
parent
2d9f83c1de
commit
063ba86447
|
|
@ -1098,7 +1098,9 @@ func (st *HelmState) PrepareCharts(helm helmexec.Interface, dir string, concurre
|
||||||
|
|
||||||
releases := releasesNeedCharts(selected)
|
releases := releasesNeedCharts(selected)
|
||||||
|
|
||||||
temp := make(map[PrepareChartKey]string, len(releases))
|
var prepareChartInfoMutex sync.Mutex
|
||||||
|
|
||||||
|
prepareChartInfo := make(map[PrepareChartKey]string, len(releases))
|
||||||
|
|
||||||
errs := []error{}
|
errs := []error{}
|
||||||
|
|
||||||
|
|
@ -1302,11 +1304,15 @@ func (st *HelmState) PrepareCharts(helm helmexec.Interface, dir string, concurre
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
temp[PrepareChartKey{
|
func() {
|
||||||
|
prepareChartInfoMutex.Lock()
|
||||||
|
defer prepareChartInfoMutex.Unlock()
|
||||||
|
prepareChartInfo[PrepareChartKey{
|
||||||
Namespace: downloadRes.releaseNamespace,
|
Namespace: downloadRes.releaseNamespace,
|
||||||
KubeContext: downloadRes.releaseContext,
|
KubeContext: downloadRes.releaseContext,
|
||||||
Name: downloadRes.releaseName,
|
Name: downloadRes.releaseName,
|
||||||
}] = downloadRes.chartPath
|
}] = downloadRes.chartPath
|
||||||
|
}()
|
||||||
|
|
||||||
if downloadRes.buildDeps {
|
if downloadRes.buildDeps {
|
||||||
builds = append(builds, downloadRes)
|
builds = append(builds, downloadRes)
|
||||||
|
|
@ -1325,7 +1331,7 @@ func (st *HelmState) PrepareCharts(helm helmexec.Interface, dir string, concurre
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return temp, nil
|
return prepareChartInfo, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// nolint: unparam
|
// nolint: unparam
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue