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 { | type service struct { | ||||||
| 	opts Options | 	opts Options | ||||||
|  |  | ||||||
| 	sync.RWMutex | 	sync.RWMutex | ||||||
| 	once sync.Once | 	//	once sync.Once | ||||||
| } | } | ||||||
|  |  | ||||||
| func newService(opts ...Option) Service { | func newService(opts ...Option) Service { | ||||||
| @@ -281,10 +280,8 @@ func (s *service) Run() error { | |||||||
| 		return err | 		return err | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	select { |  | ||||||
| 	// wait on context cancel | 	// wait on context cancel | ||||||
| 	case <-s.opts.Context.Done(): | 	<-s.opts.Context.Done() | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	return s.Stop() | 	return s.Stop() | ||||||
| } | } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user