Skip to content

Commit

Permalink
remove needs for normalized name map
Browse files Browse the repository at this point in the history
  • Loading branch information
nullfunc committed Jun 20, 2024
1 parent 00dd8e5 commit 7326d6d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 15 deletions.
2 changes: 1 addition & 1 deletion src/cmd/cli/command/servicemonitor.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
func waitServiceStatus(ctx context.Context, targetStatus cli.ServiceStatus, serviceInfos []*defangv1.ServiceInfo) error {
serviceList := []string{}
for _, serviceInfo := range serviceInfos {
serviceList = append(serviceList, serviceInfo.Service.Name)
serviceList = append(serviceList, cli.NormalizeServiceName(serviceInfo.Service.Name))
}

// set up service status subscription (non-blocking)
Expand Down
16 changes: 2 additions & 14 deletions src/pkg/cli/subscribe.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,6 @@ func Subscribe(ctx context.Context, client client.Client, services []string) (<-
return nil, fmt.Errorf("no services specified")
}

normalizedServiceNameToServiceName := make(map[string]string, len(services))

for i, service := range services {
services[i] = NormalizeServiceName(service)
normalizedServiceNameToServiceName[services[i]] = service
}

statusChan := make(chan SubscribeServiceStatus, len(services))
if DoDryRun {
defer close(statusChan)
Expand Down Expand Up @@ -65,18 +58,13 @@ func Subscribe(ctx context.Context, client client.Client, services []string) (<-
continue
}

serviceName, ok := normalizedServiceNameToServiceName[servInfo.Service.Name]
if !ok {
term.Debugf("Unknown service %s in subscribe response\n", servInfo.Service.Name)
continue
}
status := SubscribeServiceStatus{
Name: serviceName,
Name: servInfo.Service.Name,
Status: servInfo.Status,
}

statusChan <- status
term.Debugf("service %s with status %s\n", serviceName, servInfo.Status)
term.Debugf("service %s with status %s\n", servInfo.Service.Name, servInfo.Status)
}
}()

Expand Down

0 comments on commit 7326d6d

Please sign in to comment.