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