(lifecycle Lifecycle, stopped bool, startedServices int)
| 87 | } |
| 88 | |
| 89 | func (p *pool) processRunning(lifecycle Lifecycle, stopped bool, startedServices int) int { |
| 90 | if !stopped { |
| 91 | p.logger.Info(message.NewMessage(message.MServicesRunning, "All services are now running.")) |
| 92 | |
| 93 | lifecycle.Running() |
| 94 | |
| 95 | select { |
| 96 | case <-p.stopComplete: |
| 97 | // One service stopped, initiate shutdown |
| 98 | p.logger.Info(message.NewMessage(message.MServicesStopping, "Services are now stopping...")) |
| 99 | startedServices-- |
| 100 | case <-lifecycle.Context().Done(): |
| 101 | p.logger.Info(message.NewMessage(message.MServicesStopping, "Services are now stopping...")) |
| 102 | lifecycle.Stopping() |
| 103 | p.triggerStop(lifecycle.ShutdownContext()) |
| 104 | } |
| 105 | } else { |
| 106 | p.logger.Info(message.NewMessage(message.MServicesStopping, "Services are now stopping...")) |
| 107 | lifecycle.Stopping() |
| 108 | p.triggerStop(context.Background()) |
| 109 | } |
| 110 | return startedServices |
| 111 | } |
| 112 | |
| 113 | func (p *pool) runService(service Service) { |
| 114 | go func() { |
no test coverage detected