1
0
mirror of https://github.com/go-micro/go-micro.git synced 2025-06-12 22:07:47 +02:00

Prefer RegisterTTL set through Init

This commit is contained in:
Asim
2016-01-27 12:23:18 +00:00
parent 61094fefe8
commit 013d1de2c4
6 changed files with 19 additions and 30 deletions

View File

@ -155,15 +155,7 @@ func (s *rpcServer) Subscribe(sb Subscriber) error {
return nil
}
func (s *rpcServer) Register(opts ...RegisterOption) error {
var options RegisterOptions
for _, o := range opts {
o(&options)
}
// create registry options
rOpts := []registry.RegisterOption{registry.WithTTL(options.TTL)}
func (s *rpcServer) Register() error {
// parse address for host, port
config := s.Options()
var advt, host string
@ -228,6 +220,9 @@ func (s *rpcServer) Register(opts ...RegisterOption) error {
}
log.Infof("Registering node: %s", node.Id)
// create registry options
rOpts := []registry.RegisterOption{registry.RegisterTTL(config.RegisterTTL)}
if err := config.Registry.Register(service, rOpts...); err != nil {
return err
}