AwaitStopped waits for the ServiceManager to become stopped. Returns nil, if manager is stopped, error when context finishes earlier.
(ctx context.Context)
| 150 | |
| 151 | // AwaitStopped waits for the ServiceManager to become stopped. Returns nil, if manager is stopped, error when context finishes earlier. |
| 152 | func (m *Manager) AwaitStopped(ctx context.Context) error { |
| 153 | select { |
| 154 | case <-ctx.Done(): |
| 155 | return ctx.Err() |
| 156 | case <-m.stoppedCh: |
| 157 | return nil |
| 158 | } |
| 159 | } |
| 160 | |
| 161 | // ServicesByState provides a snapshot of the current state of all the services under management. |
| 162 | func (m *Manager) ServicesByState() map[State][]Service { |