Skip to content

Commit 92e0cd4

Browse files
committed
also restart dependent services after a service has been restarted
Signed-off-by: Nicolas De Loof <[email protected]>
1 parent 1a410ff commit 92e0cd4

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

cmd/compose/restart.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ func restartCommand(p *ProjectOptions, backend api.Service) *cobra.Command {
4949
}
5050

5151
func runRestart(ctx context.Context, backend api.Service, opts restartOptions, services []string) error {
52-
project, name, err := opts.projectOrName(services...)
52+
project, name, err := opts.projectOrName()
5353
if err != nil {
5454
return err
5555
}

pkg/compose/restart.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,14 +48,14 @@ func (s *composeService) restart(ctx context.Context, projectName string, option
4848
}
4949

5050
if len(options.Services) == 0 {
51-
options.Services = project.ServiceNames()
51+
err = project.ForServices(options.Services)
52+
if err != nil {
53+
return err
54+
}
5255
}
5356

5457
w := progress.ContextWriter(ctx)
5558
return InDependencyOrder(ctx, project, func(c context.Context, service string) error {
56-
if !utils.StringContains(options.Services, service) {
57-
return nil
58-
}
5959
eg, ctx := errgroup.WithContext(ctx)
6060
for _, container := range containers.filter(isService(service)) {
6161
container := container

0 commit comments

Comments
 (0)