You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Open-IM-Server/pkg/discoveryregistry/startegy.go

17 lines
237 B

2 years ago
package discoveryregistry
2 years ago
import "google.golang.org/grpc"
type Robin struct {
next int
}
func (r *Robin) Robin(slice []*grpc.ClientConn) int {
index := r.next
r.next += 1
if r.next > len(slice)-1 {
r.next = 0
}
return index
}