Skip to content

Commit

Permalink
gee-rpc/day6: rename Robin to RoundRobin
Browse files Browse the repository at this point in the history
  • Loading branch information
geektutu committed Oct 5, 2020
1 parent c66f645 commit 4c368a9
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions gee-rpc/day6-discovery/xclient/discovery.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import (
type SelectMode int

const (
RandomSelect SelectMode = iota // select randomly
RobinSelect // select using Robbin algorithm
RandomSelect SelectMode = iota // select randomly
RoundRobinSelect // select using Robbin algorithm
)

type Discovery interface {
Expand Down Expand Up @@ -45,7 +45,7 @@ func (d *MultiServersDiscovery) Get(mode SelectMode) string {
switch mode {
case RandomSelect:
return d.servers[d.r.Intn(len(d.servers))]
case RobinSelect:
case RoundRobinSelect:
s := d.servers[d.index]
d.index = (d.index + 1) % len(d.servers)
return s
Expand Down

0 comments on commit 4c368a9

Please sign in to comment.