From dd105a917a4df2670fea6743168ab813bc34cd02 Mon Sep 17 00:00:00 2001 From: Ben Kochie Date: Mon, 11 Sep 2017 20:06:47 +0200 Subject: Add unicorn-soft-timeout * Add the `unicorn-soft-timeout` gem to `SIGQUIT` rather than `SIGKILL` on timeout. * Configure to 55 seconds by default (60 seconds is default for `SIGKILL`). --- Gemfile | 1 + config.ru | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/Gemfile b/Gemfile index cc6618d3557..b6916b5117e 100644 --- a/Gemfile +++ b/Gemfile @@ -137,6 +137,7 @@ gem 'diffy', '~> 3.1.0' group :unicorn do gem 'unicorn', '~> 5.1.0' gem 'unicorn-worker-killer', '~> 0.4.4' + gem 'unicorn-soft-timeout', '~> 0.2.0' end # State machine diff --git a/config.ru b/config.ru index 065ce59932f..e0b21ac66e8 100644 --- a/config.ru +++ b/config.ru @@ -2,6 +2,7 @@ if defined?(Unicorn) require 'unicorn' + require 'unicorn/soft_timeout' if ENV['RAILS_ENV'] == 'production' || ENV['RAILS_ENV'] == 'staging' # Unicorn self-process killer @@ -12,6 +13,9 @@ if defined?(Unicorn) # Max memory size (RSS) per worker use Unicorn::WorkerKiller::Oom, min, max + + soft_timeout = (ENV['GITLAB_UNICORN_SOFT_TIMEOUT'] || 55).to_i + use Unicorn::SoftTimeout soft_timeout end end -- cgit v1.2.1