@ -93,21 +93,28 @@ func updateCharts(repos []*repo.ChartRepository, out io.Writer, home helmpath.Ho
var (
var (
errorCounter int
errorCounter int
wg sync . WaitGroup
wg sync . WaitGroup
mu sync . Mutex
)
)
for _ , re := range repos {
for _ , re := range repos {
wg . Add ( 1 )
wg . Add ( 1 )
go func ( re * repo . ChartRepository ) {
go func ( re * repo . ChartRepository ) {
defer wg . Done ( )
defer wg . Done ( )
if re . Config . Name == localRepository {
if re . Config . Name == localRepository {
mu . Lock ( )
fmt . Fprintf ( out , "...Skip %s chart repository\n" , re . Config . Name )
fmt . Fprintf ( out , "...Skip %s chart repository\n" , re . Config . Name )
mu . Unlock ( )
return
return
}
}
err := re . DownloadIndexFile ( home . Cache ( ) )
err := re . DownloadIndexFile ( home . Cache ( ) )
if err != nil {
if err != nil {
mu . Lock ( )
errorCounter ++
errorCounter ++
fmt . Fprintf ( out , "...Unable to get an update from the %q chart repository (%s):\n\t%s\n" , re . Config . Name , re . Config . URL , err )
fmt . Fprintf ( out , "...Unable to get an update from the %q chart repository (%s):\n\t%s\n" , re . Config . Name , re . Config . URL , err )
mu . Unlock ( )
} else {
} else {
mu . Lock ( )
fmt . Fprintf ( out , "...Successfully got an update from the %q chart repository\n" , re . Config . Name )
fmt . Fprintf ( out , "...Successfully got an update from the %q chart repository\n" , re . Config . Name )
mu . Unlock ( )
}
}
} ( re )
} ( re )
}
}