Skip to content

Commit

Permalink
last try
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex Wissmann committed Jul 20, 2020
1 parent c452f9c commit acb8c3a
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 9 deletions.
2 changes: 1 addition & 1 deletion cmd/slicer/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ Available test are:

wait := flag.Bool("wait", false, "don't exit after completion")
sess := sliceconfig.Parse()
defer sess.Shutdown()

if flag.NArg() == 0 {
flag.Usage()
Expand All @@ -61,6 +60,7 @@ Available test are:
case "oom":
err = oomer(sess, args)
}
sess.Shutdown()
if *wait {
if err != nil {
log.Printf("finished with error %v: waiting", err)
Expand Down
9 changes: 3 additions & 6 deletions exec/bigmachine.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,19 +157,15 @@ func (b *bigmachineExecutor) Start(sess *Session) (shutdown func()) {

return func() {
close(b.shutdownc)
b.managersWG.Wait()
b.b.Shutdown()
b.managersWG.Wait()
}
}

func (b *bigmachineExecutor) manager(i int) *machineManager {
b.mu.Lock()
defer b.mu.Unlock()
ctx, cancel := context.WithCancel(backgroundcontext.Get())
go func() {
<-b.shutdownc
cancel()
}()
ctx, _ := context.WithCancel(backgroundcontext.Get())
for i >= len(b.managers) {
b.managers = append(b.managers, nil)
}
Expand All @@ -186,6 +182,7 @@ func (b *bigmachineExecutor) manager(i int) *machineManager {
go func() {
b.managers[i].Do(ctx, b.shutdownc)
b.managers[i].machinesWG.Wait()
log.Print("Manager Done")
b.managersWG.Done()
}()
}
Expand Down
3 changes: 1 addition & 2 deletions exec/slicemachine.go
Original file line number Diff line number Diff line change
Expand Up @@ -187,8 +187,6 @@ loop:
s.UpdateStatus()
select {
case <-time.After(statsPollInterval):
case <-shutdownc:
return
case <-stopped:
break loop
}
Expand Down Expand Up @@ -555,6 +553,7 @@ func (m *machineManager) Do(ctx context.Context, shutdownc chan struct{}) {
m.machinesWG.Add(1)
go func(sm *sliceMachine) {
sm.Go(ctx, shutdownc)
log.Print("machine done")
m.machinesWG.Done()
}(machine)
}
Expand Down

0 comments on commit acb8c3a

Please sign in to comment.