diff --git a/src/redis-shake/main/main.go b/src/redis-shake/main/main.go index d1565e4..89fcb72 100644 --- a/src/redis-shake/main/main.go +++ b/src/redis-shake/main/main.go @@ -236,15 +236,11 @@ func sanitizeOptions(tp string) error { } if tp == conf.TypeDump || tp == conf.TypeSync { - if conf.Options.SourceRdbParallel <= 0 { - conf.Options.SourceRdbParallel = len(conf.Options.SourceAddressList) - } else if conf.Options.SourceRdbParallel > len(conf.Options.SourceAddressList) { + if conf.Options.SourceRdbParallel <= 0 || conf.Options.SourceRdbParallel > len(conf.Options.SourceAddressList) { conf.Options.SourceRdbParallel = len(conf.Options.SourceAddressList) } } else if tp == conf.TypeRestore || tp == conf.TypeDecode { - if conf.Options.SourceRdbParallel <= 0 { - conf.Options.SourceRdbParallel = len(conf.Options.SourceRdbInput) - } else if conf.Options.SourceRdbParallel > len(conf.Options.SourceRdbInput) { + if conf.Options.SourceRdbParallel <= 0 || conf.Options.SourceRdbParallel > len(conf.Options.SourceRdbInput) { conf.Options.SourceRdbParallel = len(conf.Options.SourceRdbInput) } } diff --git a/src/redis-shake/restore.go b/src/redis-shake/restore.go index 708e2af..4c000f8 100644 --- a/src/redis-shake/restore.go +++ b/src/redis-shake/restore.go @@ -45,7 +45,7 @@ func (cmd *CmdRestore) Main() { base.Status = "waitRestore" total := utils.GetTotalLink() restoreChan := make(chan restoreNode, total) - + for i, rdb := range conf.Options.SourceRdbInput { restoreChan <- restoreNode{id: i, input: rdb} }