Limit download concurrency to 25 threads

This commit is contained in:
morganamilo 2018-09-04 18:28:36 +01:00
parent 2b6a73041f
commit 1beeaaf299
No known key found for this signature in database
GPG key ID: 6FE9E7996B0B082E
2 changed files with 10 additions and 0 deletions

View file

@ -286,9 +286,14 @@ func getPkgbuildsfromABS(pkgs []string, path string) (bool, error) {
mux.Unlock()
}
count := 0
for name, url := range names {
wg.Add(1)
go download(name, url)
count++
if count%25 == 0 {
wg.Wait()
}
}
wg.Wait()

View file

@ -872,9 +872,14 @@ func downloadPkgbuilds(bases []Base, toSkip stringSet, buildDir string) (stringS
mux.Unlock()
}
count := 0
for k, base := range bases {
wg.Add(1)
go download(k, base)
count++
if count%25 == 0 {
wg.Wait()
}
}
wg.Wait()