Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitaly.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Cai <jcai@gitlab.com>2023-08-26 00:48:13 +0300
committerJohn Cai <jcai@gitlab.com>2023-08-31 00:50:39 +0300
commit53dc3d8273cf7f2be813821f4e8c7f0f6c8a78b4 (patch)
tree0f8399ac7be21af61296f40d08f44562c1660274
parentd622d0f774ef651c0eff7c86ca79e92fcc2d8747 (diff)
gitaly: Set kill function for killing off processes that stay alivejc/kill-git-processes
Now that we have a way to kill processes with sigkill after a determined amount of time, let's use it in the main command factory.
-rw-r--r--internal/cli/gitaly/serve.go9
1 files changed, 9 insertions, 0 deletions
diff --git a/internal/cli/gitaly/serve.go b/internal/cli/gitaly/serve.go
index fd4470241..d90460910 100644
--- a/internal/cli/gitaly/serve.go
+++ b/internal/cli/gitaly/serve.go
@@ -210,6 +210,15 @@ func run(cfg config.Cfg, logger logrus.FieldLogger) error {
commandFactoryOpts = append(commandFactoryOpts, git.WithSkipHooks())
}
+ commandKillWait := (cfg.GracefulRestartTimeout.Duration() * 3) / 4
+ commandFactoryOpts = append(
+ commandFactoryOpts,
+ git.WithKillFunc(
+ time.After(commandKillWait),
+ helper.NewTimerTicker(commandKillWait/5),
+ ),
+ )
+
gitCmdFactory, cleanup, err := git.NewExecCommandFactory(cfg, logger, commandFactoryOpts...)
if err != nil {
return fmt.Errorf("creating Git command factory: %w", err)