Revert change to allow trying to kill again if a kill fails
Signed-off-by: Jaime Soriano Pastor <jaime.soriano@elastic.co>
This commit is contained in:
parent
6a3501f901
commit
7d3616474d
|
|
@ -21,7 +21,6 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
"os/signal"
|
"os/signal"
|
||||||
"sync/atomic"
|
|
||||||
"syscall"
|
"syscall"
|
||||||
|
|
||||||
"github.com/compose-spec/compose-go/v2/types"
|
"github.com/compose-spec/compose-go/v2/types"
|
||||||
|
|
@ -109,8 +108,6 @@ func (s *composeService) Up(ctx context.Context, project *types.Project, options
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// killRunning is used to control that we don't run more than one kill if signals are spammed.
|
|
||||||
var killRunning atomic.Bool
|
|
||||||
for {
|
for {
|
||||||
select {
|
select {
|
||||||
case <-doneCh:
|
case <-doneCh:
|
||||||
|
|
@ -124,13 +121,7 @@ func (s *composeService) Up(ctx context.Context, project *types.Project, options
|
||||||
gracefulTeardown()
|
gracefulTeardown()
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
if !killRunning.CompareAndSwap(false, true) {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
eg.Go(func() error {
|
eg.Go(func() error {
|
||||||
defer killRunning.Store(false)
|
|
||||||
// Intentionally ignore errors, for cases where some
|
|
||||||
// of the containers are already stopped.
|
|
||||||
err := s.kill(context.Background(), project.Name, api.KillOptions{
|
err := s.kill(context.Background(), project.Name, api.KillOptions{
|
||||||
Services: options.Create.Services,
|
Services: options.Create.Services,
|
||||||
Project: project,
|
Project: project,
|
||||||
|
|
@ -143,6 +134,7 @@ func (s *composeService) Up(ctx context.Context, project *types.Project, options
|
||||||
|
|
||||||
return err
|
return err
|
||||||
})
|
})
|
||||||
|
return nil
|
||||||
case event := <-kEvents:
|
case event := <-kEvents:
|
||||||
formatter.KeyboardManager.HandleKeyEvents(event, ctx, project, options)
|
formatter.KeyboardManager.HandleKeyEvents(event, ctx, project, options)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue