Forráskód Böngészése

Limit download concurrency to 25 threads

morganamilo 6 éve
szülő
commit
1beeaaf299
2 módosított fájl, 10 hozzáadás és 0 törlés
  1. 5 0
      download.go
  2. 5 0
      install.go

+ 5 - 0
download.go

@@ -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()

+ 5 - 0
install.go

@@ -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()