(ctx context.Context, containers []scalingo.Container, names []string)
| 30 | } |
| 31 | |
| 32 | func keepUniqueContainersWithNames(ctx context.Context, containers []scalingo.Container, names []string) map[string]scalingo.Container { |
| 33 | containersToKill := map[string]scalingo.Container{} |
| 34 | |
| 35 | for _, name := range names { |
| 36 | for _, container := range containers { |
| 37 | if container.Label == name { |
| 38 | containersToKill[name] = container |
| 39 | } |
| 40 | } |
| 41 | if _, ok := containersToKill[name]; !ok { |
| 42 | containersToKillWithType, err := keepUniqueContainersWithType(ctx, containers, name) |
| 43 | if err != nil { |
| 44 | io.Error(err.Error()) |
| 45 | continue |
| 46 | } |
| 47 | |
| 48 | maps.Copy(containersToKill, containersToKillWithType) |
| 49 | } |
| 50 | } |
| 51 | |
| 52 | return containersToKill |
| 53 | } |
| 54 | |
| 55 | func SendSignal(ctx context.Context, appName string, signal string, containerNames []string) error { |
| 56 | if len(containerNames) == 0 { |
no test coverage detected