Update registry so version is surfaced

This commit is contained in:
Asim
2015-11-08 01:48:48 +00:00
parent 4e6d1df9ea
commit 0320fc1b55
12 changed files with 453 additions and 90 deletions

View File

@@ -3,10 +3,8 @@ package client
import (
"encoding/json"
"fmt"
"math/rand"
"net/http"
"sync"
"time"
"github.com/myodc/go-micro/broker"
c "github.com/myodc/go-micro/context"
@@ -29,10 +27,6 @@ type rpcClient struct {
opts options
}
func init() {
rand.Seed(time.Now().UnixNano())
}
func newRpcClient(opt ...Option) Client {
var opts options
@@ -129,13 +123,11 @@ func (r *rpcClient) Call(ctx context.Context, request Request, response interfac
return errors.InternalServerError("go.micro.client", err.Error())
}
if len(service.Nodes) == 0 {
return errors.NotFound("go.micro.client", "Service not found")
node, err := nodeSelector(service)
if err != nil {
return err
}
n := rand.Int() % len(service.Nodes)
node := service.Nodes[n]
address := node.Address
if node.Port > 0 {
address = fmt.Sprintf("%s:%d", address, node.Port)
@@ -154,13 +146,11 @@ func (r *rpcClient) Stream(ctx context.Context, request Request, responseChan in
return nil, errors.InternalServerError("go.micro.client", err.Error())
}
if len(service.Nodes) == 0 {
return nil, errors.NotFound("go.micro.client", "Service not found")
node, err := nodeSelector(service)
if err != nil {
return nil, err
}
n := rand.Int() % len(service.Nodes)
node := service.Nodes[n]
address := node.Address
if node.Port > 0 {
address = fmt.Sprintf("%s:%d", address, node.Port)