simplify service stop waiting

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
Василий Толстов 2020-11-10 10:59:26 +03:00
parent 77dab8ee15
commit fa9ef1c816

View File

@ -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()
}