StartAll starts all given services. If any service returns an error while being started, that error is returned, and any services that were started successfully up to that point are stopped.
(ctx context.Context, services ...Service)
| 281 | // being started, that error is returned, and any services that were started |
| 282 | // successfully up to that point are stopped. |
| 283 | func StartAll(ctx context.Context, services ...Service) error { |
| 284 | for i, service := range services { |
| 285 | if err := service.Start(ctx); err != nil { |
| 286 | StopAllParallel(services[0:i]...) |
| 287 | |
| 288 | return err |
| 289 | } |
| 290 | } |
| 291 | return nil |
| 292 | } |
| 293 | |
| 294 | // StopAllParallel stops all the given services in parallel and waits until |
| 295 | // they've all stopped successfully. |
searching dependent graphs…