From f2413a7789378587b7aaef728308a1331a91fc70 Mon Sep 17 00:00:00 2001 From: Vasiliy Tolstov Date: Wed, 28 Oct 2020 12:02:57 +0300 Subject: [PATCH] disconnect from stuff on service stop Signed-off-by: Vasiliy Tolstov --- service.go | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/service.go b/service.go index 4723dd6d..4d814f9d 100644 --- a/service.go +++ b/service.go @@ -164,14 +164,6 @@ func (s *service) Start() error { } } - /* - if s.opts.Transport != nil { - if err := s.opts.Transport.Connect(s.opts.Context); err != nil { - return err - } - } - */ - if s.opts.Store != nil { if err := s.opts.Store.Connect(s.opts.Context); err != nil { return err @@ -213,6 +205,24 @@ func (s *service) Stop() error { } } + if s.opts.Registry != nil { + if err := s.opts.Registry.Disconnect(s.opts.Context); err != nil { + return err + } + } + + if s.opts.Broker != nil { + if err := s.opts.Broker.Disconnect(s.opts.Context); err != nil { + return err + } + } + + if s.opts.Store != nil { + if err := s.opts.Store.Disconnect(s.opts.Context); err != nil { + return err + } + } + return nil }