Prechádzať zdrojové kódy

only stop dependent containers ... if there's some

Signed-off-by: Nicolas De Loof <[email protected]>
Nicolas De Loof 1 rok pred
rodič
commit
6b3e57503e
1 zmenil súbory, kde vykonal 3 pridanie a 0 odobranie
  1. 3 0
      pkg/compose/convergence.go

+ 3 - 0
pkg/compose/convergence.go

@@ -226,6 +226,9 @@ func (c *convergence) ensureService(ctx context.Context, project *types.Project,
 func (c *convergence) stopDependentContainers(ctx context.Context, project *types.Project, service types.ServiceConfig) error {
 func (c *convergence) stopDependentContainers(ctx context.Context, project *types.Project, service types.ServiceConfig) error {
 	// Stop dependent containers, so they will be restarted after service is re-created
 	// Stop dependent containers, so they will be restarted after service is re-created
 	dependents := project.GetDependentsForService(service)
 	dependents := project.GetDependentsForService(service)
+	if len(dependents) == 0 {
+		return nil
+	}
 	err := c.service.stop(ctx, project.Name, api.StopOptions{
 	err := c.service.stop(ctx, project.Name, api.StopOptions{
 		Services: dependents,
 		Services: dependents,
 		Project:  project,
 		Project:  project,