[jiri] reduce default concurrency to ncpu*2
The default of 25 jobs is far too high for the average mac system.
Change-Id: I2b4b08d1d9fb3471efc7bb6dd6802d654f5ff47d
diff --git a/x.go b/x.go
index dadd7a7..372710a 100644
--- a/x.go
+++ b/x.go
@@ -15,6 +15,7 @@
"io/ioutil"
"os"
"path/filepath"
+ "runtime"
"sync/atomic"
"time"
@@ -167,7 +168,13 @@
return nil
}
+var DefaultJobs = uint(runtime.NumCPU() * 2)
+
func init() {
+ // Cap jobs at 50 to avoid flooding Gerrit with too many requests
+ if DefaultJobs > 50 {
+ DefaultJobs = 50
+ }
flag.StringVar(&rootFlag, "root", "", "Jiri root directory")
flag.UintVar(&jobsFlag, "j", DefaultJobs, "Number of jobs (commands) to run simultaneously")
flag.StringVar(&colorFlag, "color", "auto", "Use color to format output. Values can be always, never and auto")
@@ -273,8 +280,6 @@
return x, nil
}
-const DefaultJobs = 25
-
func cleanPath(path string) (string, error) {
result, err := filepath.EvalSymlinks(path)
if err != nil {