From fa9ef1c8165d8958fa054e5f21b87df013be2949 Mon Sep 17 00:00:00 2001 From: Vasiliy Tolstov Date: Tue, 10 Nov 2020 10:59:26 +0300 Subject: [PATCH] simplify service stop waiting Signed-off-by: Vasiliy Tolstov --- service.go | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/service.go b/service.go index c935cfcd..d8b45b04 100644 --- a/service.go +++ b/service.go @@ -19,9 +19,8 @@ import ( type service struct { opts Options - sync.RWMutex - once sync.Once + // once sync.Once } func newService(opts ...Option) Service { @@ -281,10 +280,8 @@ func (s *service) Run() error { return err } - select { // wait on context cancel - case <-s.opts.Context.Done(): - } + <-s.opts.Context.Done() return s.Stop() }