Skip to content

Commit

Permalink
Optimize nodes meet in cli
Browse files Browse the repository at this point in the history
  • Loading branch information
yongman committed Sep 10, 2015
1 parent 69d1b65 commit 192c05c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
*~
cc
cli/cli
*.orig
4 changes: 2 additions & 2 deletions cli/command/initialize/redis.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ func clusterNodes(node *Node) (string, error) {
}

func meetEach(nodes []*Node) {
for _, n1 := range nodes {
for _, n2 := range nodes {
for _, n1 := range nodes[:len(nodes)/2] {
for _, n2 := range nodes[len(nodes)/2:] {
if n1 != n2 {
addr := fmt.Sprintf("%s:%s", n1.Ip, n1.Port)
newPort, _ := strconv.Atoi(n2.Port)
Expand Down

0 comments on commit 192c05c

Please sign in to comment.