also restart dependent services after a service has been restarted

Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
This commit is contained in:
Nicolas De Loof 2023-02-13 15:53:51 +01:00 committed by Nicolas De loof
parent 1a410ffe30
commit 92e0cd4047
2 changed files with 5 additions and 5 deletions

View File

@ -49,7 +49,7 @@ func restartCommand(p *ProjectOptions, backend api.Service) *cobra.Command {
}
func runRestart(ctx context.Context, backend api.Service, opts restartOptions, services []string) error {
project, name, err := opts.projectOrName(services...)
project, name, err := opts.projectOrName()
if err != nil {
return err
}

View File

@ -48,14 +48,14 @@ func (s *composeService) restart(ctx context.Context, projectName string, option
}
if len(options.Services) == 0 {
options.Services = project.ServiceNames()
err = project.ForServices(options.Services)
if err != nil {
return err
}
}
w := progress.ContextWriter(ctx)
return InDependencyOrder(ctx, project, func(c context.Context, service string) error {
if !utils.StringContains(options.Services, service) {
return nil
}
eg, ctx := errgroup.WithContext(ctx)
for _, container := range containers.filter(isService(service)) {
container := container