1
0
mirror of https://github.com/go-micro/go-micro.git synced 2025-06-18 22:17:44 +02:00

add RegisterCheck web server option for internal health checks

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
Vasiliy Tolstov
2019-12-05 17:15:35 +03:00
parent 18cf025056
commit a957e90ca8
3 changed files with 24 additions and 1 deletions

View File

@ -123,6 +123,13 @@ func (s *service) register() error {
srv := s.genSrv()
srv.Endpoints = s.srv.Endpoints
s.srv = srv
// use RegisterCheck func before register
if err := s.opts.RegisterCheck(s.opts.Context); err != nil {
log.Logf("Server %s-%s register check error: %s", s.opts.Name, s.opts.Id, err)
return err
}
return r.Register(s.srv, registry.RegisterTTL(s.opts.RegisterTTL))
}