Fixed options bug and proto indenting
This commit is contained in:
parent
8417361bce
commit
204c7d1fcf
@ -28,8 +28,10 @@ func (r *Registry) GetService(ctx context.Context, req *pb.GetRequest, rsp *pb.G
|
|||||||
|
|
||||||
func (r *Registry) Register(ctx context.Context, req *pb.Service, rsp *pb.EmptyResponse) error {
|
func (r *Registry) Register(ctx context.Context, req *pb.Service, rsp *pb.EmptyResponse) error {
|
||||||
var regOpts []registry.RegisterOption
|
var regOpts []registry.RegisterOption
|
||||||
ttl := time.Duration(req.Options.Ttl) * time.Second
|
if req.Options != nil {
|
||||||
regOpts = append(regOpts, registry.RegisterTTL(ttl))
|
ttl := time.Duration(req.Options.Ttl) * time.Second
|
||||||
|
regOpts = append(regOpts, registry.RegisterTTL(ttl))
|
||||||
|
}
|
||||||
|
|
||||||
err := r.Registry.Register(service.ToService(req), regOpts...)
|
err := r.Registry.Register(service.ToService(req), regOpts...)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -12,11 +12,11 @@ service Registry {
|
|||||||
|
|
||||||
// Service represents a go-micro service
|
// Service represents a go-micro service
|
||||||
message Service {
|
message Service {
|
||||||
string name = 1;
|
string name = 1;
|
||||||
string version = 2;
|
string version = 2;
|
||||||
map<string,string> metadata = 3;
|
map<string,string> metadata = 3;
|
||||||
repeated Endpoint endpoints = 4;
|
repeated Endpoint endpoints = 4;
|
||||||
repeated Node nodes = 5;
|
repeated Node nodes = 5;
|
||||||
Options options = 6;
|
Options options = 6;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user