Add TTL options to memory registry.
This commit is contained in:
@@ -28,10 +28,8 @@ 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 {
|
||||
var regOpts []registry.RegisterOption
|
||||
regTTL, ok := ctx.Value("register_ttl").(time.Duration)
|
||||
if ok {
|
||||
regOpts = append(regOpts, registry.RegisterTTL(regTTL))
|
||||
}
|
||||
ttl := time.Duration(req.Options.Ttl)
|
||||
regOpts = append(regOpts, registry.RegisterTTL(ttl))
|
||||
|
||||
err := r.Registry.Register(service.ToService(req), regOpts...)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user