Abort a bad idea

This commit is contained in:
Joel Elkins 2022-08-13 22:52:31 -05:00
parent 50cb8543f7
commit 71f830887e
No known key found for this signature in database
GPG Key ID: 133589DC38921AE2

View File

@ -38,40 +38,6 @@ type runner struct{
GroupScale int
}
func execSetsForEachGroup(tgts [] container.Container, runners []runner) {
var ser sync.Mutex // serialize non-async containers
runLevel := make(map[int][]container.Container)
for i := range tgts {
rl := tgts[i].StartGroup
runLevel[rl] = append(runLevel[rl], tgts[i])
}
rls := maps.Keys(runLevel)
slices.Sort(rls)
for _, r := range rls {
cs := runLevel[r]
ser.Lock()
fmt.Fprintln(output, "*** Running a command set for group", r, mapNames(cs))
go func(async bool, conts []container.Container, ser *sync.Mutex) {
var wg sync.WaitGroup
defer func() {
wg.Wait()
ser.Unlock()
}()
for i := range conts {
wg.Add(1)
go runSet(&conts[i], getSet, &wg)
}
if !async {
time.Sleep(2 * time.Second)
}
}(r == 0, cs, &ser)
}
ser.Lock()
}
func execForEach(tgts []container.Container, getSet func(*container.Container) command.CommandSet, groupScale int) {
var ser sync.Mutex // serialize non-async containers
runLevel := make(map[int][]container.Container)