fix QueryInstancesOfService clusters (#578)
This commit is contained in:
parent
e190e290f5
commit
82a862a9a4
|
@ -158,8 +158,8 @@ func (proxy *NamingGrpcProxy) ServerHealthy() bool {
|
|||
}
|
||||
|
||||
// QueryInstancesOfService ...
|
||||
func (proxy *NamingGrpcProxy) QueryInstancesOfService(serviceName, groupName, clusters string, udpPort int, healthyOnly bool) (*model.Service, error) {
|
||||
response, err := proxy.requestToServer(rpc_request.NewServiceQueryRequest(proxy.clientConfig.NamespaceId, serviceName, groupName, clusters,
|
||||
func (proxy *NamingGrpcProxy) QueryInstancesOfService(serviceName, groupName, cluster string, udpPort int, healthyOnly bool) (*model.Service, error) {
|
||||
response, err := proxy.requestToServer(rpc_request.NewServiceQueryRequest(proxy.clientConfig.NamespaceId, serviceName, groupName, cluster,
|
||||
healthyOnly, udpPort))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
|
|
@ -138,15 +138,15 @@ func (r *SubscribeServiceRequest) GetRequestType() string {
|
|||
|
||||
type ServiceQueryRequest struct {
|
||||
*NamingRequest
|
||||
Clusters string `json:"clusters"`
|
||||
Cluster string `json:"cluster"`
|
||||
HealthyOnly bool `json:"healthyOnly"`
|
||||
UdpPort int `json:"udpPort"`
|
||||
}
|
||||
|
||||
func NewServiceQueryRequest(namespace, serviceName, groupName, clusters string, healthyOnly bool, udpPort int) *ServiceQueryRequest {
|
||||
func NewServiceQueryRequest(namespace, serviceName, groupName, cluster string, healthyOnly bool, udpPort int) *ServiceQueryRequest {
|
||||
return &ServiceQueryRequest{
|
||||
NamingRequest: NewNamingRequest(namespace, serviceName, groupName),
|
||||
Clusters: clusters,
|
||||
Cluster: cluster,
|
||||
HealthyOnly: healthyOnly,
|
||||
UdpPort: udpPort,
|
||||
}
|
||||
|
|
|
@ -129,6 +129,7 @@ func main() {
|
|||
ServiceName: "demo.go",
|
||||
GroupName: "group-a",
|
||||
Clusters: []string{"cluster-a"},
|
||||
HealthyOnly: true,
|
||||
})
|
||||
|
||||
//SelectOneHealthyInstance return one instance by WRR strategy for load balance
|
||||
|
@ -154,7 +155,7 @@ func main() {
|
|||
//wait for client pull change from server
|
||||
time.Sleep(3 * time.Second)
|
||||
|
||||
/*updateServiceInstance(client, vo.UpdateInstanceParam{
|
||||
updateServiceInstance(client, vo.UpdateInstanceParam{
|
||||
Ip: "10.0.0.11", //update ip
|
||||
Port: 8848,
|
||||
ServiceName: "demo.go",
|
||||
|
@ -165,7 +166,7 @@ func main() {
|
|||
Healthy: true,
|
||||
Ephemeral: true,
|
||||
Metadata: map[string]string{"idc": "beijing1"}, //update metadata
|
||||
})*/
|
||||
})
|
||||
|
||||
//wait for client pull change from server
|
||||
time.Sleep(3 * time.Second)
|
||||
|
|
|
@ -89,7 +89,7 @@ type SelectInstancesParam struct {
|
|||
Clusters []string `param:"clusters"` //optional
|
||||
ServiceName string `param:"serviceName"` //required
|
||||
GroupName string `param:"groupName"` //optional,default:DEFAULT_GROUP
|
||||
HealthyOnly bool `param:"healthyOnly"` //optional,return only healthy instance
|
||||
HealthyOnly bool `param:"healthyOnly"` //optional,value = true return only healthy instance, value = false return only unHealthy instance
|
||||
}
|
||||
|
||||
type SelectOneHealthInstanceParam struct {
|
||||
|
|
Loading…
Reference in New Issue