Skip to content

Commit

Permalink
Revert change to allow trying to kill again if a kill fails
Browse files Browse the repository at this point in the history
Signed-off-by: Jaime Soriano Pastor <jaime.soriano@elastic.co>
  • Loading branch information
jsoriano authored and ndeloof committed Apr 14, 2024
1 parent 6a3501f commit 7d36164
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions pkg/compose/up.go
Expand Up @@ -21,7 +21,6 @@ import (
"fmt"
"os"
"os/signal"
"sync/atomic"
"syscall"

"github.com/compose-spec/compose-go/v2/types"
Expand Down Expand Up @@ -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 {
select {
case <-doneCh:
Expand All @@ -124,13 +121,7 @@ func (s *composeService) Up(ctx context.Context, project *types.Project, options
gracefulTeardown()
break
}
if !killRunning.CompareAndSwap(false, true) {
break
}
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{
Services: options.Create.Services,
Project: project,
Expand All @@ -143,6 +134,7 @@ func (s *composeService) Up(ctx context.Context, project *types.Project, options

return err
})
return nil
case event := <-kEvents:
formatter.KeyboardManager.HandleKeyEvents(event, ctx, project, options)
}
Expand Down

0 comments on commit 7d36164

Please sign in to comment.