set parallel to 1 when not set

v4
vinllen 6 years ago
parent 3cc9d6bf03
commit c7e4c5e446
  1. 4
      src/redis-shake/main/main.go

@ -172,7 +172,9 @@ func sanitizeOptions(tp string) error {
runtime.GOMAXPROCS(conf.Options.NCpu)
}
if conf.Options.Parallel == 0 || conf.Options.Parallel > 1024 {
if conf.Options.Parallel == 0 {
conf.Options.Parallel = 1
} else if conf.Options.Parallel > 1024 {
return fmt.Errorf("parallel[%v] should in (0, 1024]", conf.Options.Parallel)
} else {
conf.Options.Parallel = int(math.Max(float64(conf.Options.Parallel), float64(conf.Options.NCpu)))

Loading…
Cancel
Save