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:
@ -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
|
||||
}
|
||||
|
Reference in New Issue
Block a user