From 01b7dd6fb5a8c63dc3e0f4c5444c859c3266c97d Mon Sep 17 00:00:00 2001 From: Valery Piashchynski Date: Tue, 31 May 2022 15:31:39 +0200 Subject: add force stop Signed-off-by: Valery Piashchynski --- internal/cli/serve/command.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'internal/cli/serve') diff --git a/internal/cli/serve/command.go b/internal/cli/serve/command.go index 6cbdef44..a85beb89 100644 --- a/internal/cli/serve/command.go +++ b/internal/cli/serve/command.go @@ -5,6 +5,7 @@ import ( "os" "os/signal" "syscall" + "time" "github.com/roadrunner-server/roadrunner/v2/internal/container" "github.com/roadrunner-server/roadrunner/v2/internal/meta" @@ -73,7 +74,7 @@ func NewCommand(override *[]string, cfgFile *string, silent *bool) *cobra.Comman return errors.E(op, err) } - oss, stop := make(chan os.Signal, 2), make(chan struct{}, 1) //nolint:gomnd + oss, stop := make(chan os.Signal, 5), make(chan struct{}, 1) //nolint:gomnd signal.Notify(oss, os.Interrupt, syscall.SIGTERM, syscall.SIGINT) go func() { @@ -100,6 +101,7 @@ func NewCommand(override *[]string, cfgFile *string, silent *bool) *cobra.Comman case <-stop: // stop the container after first signal fmt.Printf("stop signal received, grace timeout is: %0.f seconds\n", containerCfg.GracePeriod.Seconds()) + time.Sleep(time.Second * 100) if err = endureContainer.Stop(); err != nil { return fmt.Errorf("error: %w", err) } -- cgit v1.2.3