simplify service stop waiting
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
parent
77dab8ee15
commit
fa9ef1c816
@ -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()
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user