diff options
-rw-r--r-- | changelogs/unreleased/an-move-puma-killer-to-an-initializer.yml | 5 | ||||
-rw-r--r-- | config/initializers/puma.rb | 11 | ||||
-rw-r--r-- | config/puma.example.development.rb | 3 | ||||
-rw-r--r-- | config/puma.rb.example | 4 | ||||
-rw-r--r-- | lib/gitlab/cluster/lifecycle_events.rb | 2 |
5 files changed, 16 insertions, 9 deletions
diff --git a/changelogs/unreleased/an-move-puma-killer-to-an-initializer.yml b/changelogs/unreleased/an-move-puma-killer-to-an-initializer.yml new file mode 100644 index 00000000000..5a38bb2e339 --- /dev/null +++ b/changelogs/unreleased/an-move-puma-killer-to-an-initializer.yml @@ -0,0 +1,5 @@ +--- +title: Attach the Puma Worker Killer through Lifecycle Events +merge_request: 29594 +author: +type: other diff --git a/config/initializers/puma.rb b/config/initializers/puma.rb new file mode 100644 index 00000000000..bf56be41b9b --- /dev/null +++ b/config/initializers/puma.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +require "gitlab/cluster/lifecycle_events" + +if Gitlab::Cluster::LifecycleEvents.in_clustered_puma? + unless ENV['DISABLE_PUMA_WORKER_KILLER'] + require "gitlab/cluster/puma_worker_killer_initializer" + + Gitlab::Cluster::PumaWorkerKillerInitializer.start @config.options unless ENV['DISABLE_PUMA_WORKER_KILLER'] + end +end diff --git a/config/puma.example.development.rb b/config/puma.example.development.rb index 9df24bf74e3..061825d866e 100644 --- a/config/puma.example.development.rb +++ b/config/puma.example.development.rb @@ -49,9 +49,6 @@ on_restart do end before_fork do - # Signal to the puma killer - Gitlab::Cluster::PumaWorkerKillerInitializer.start @config.options unless ENV['DISABLE_PUMA_WORKER_KILLER'] - # Signal application hooks that we're about to fork Gitlab::Cluster::LifecycleEvents.do_before_fork end diff --git a/config/puma.rb.example b/config/puma.rb.example index 6558dbc6cfe..4d1dcef30b6 100644 --- a/config/puma.rb.example +++ b/config/puma.rb.example @@ -36,7 +36,6 @@ bind 'unix:///home/git/gitlab/tmp/sockets/gitlab.socket' workers 3 require_relative "/home/git/gitlab/lib/gitlab/cluster/lifecycle_events" -require_relative "/home/git/gitlab/lib/gitlab/cluster/puma_worker_killer_initializer" on_restart do # Signal application hooks that we're about to restart @@ -44,9 +43,6 @@ on_restart do end before_fork do - # Signal to the puma killer - Gitlab::Cluster::PumaWorkerKillerInitializer.start @config.options unless ENV['DISABLE_PUMA_WORKER_KILLER'] - # Signal application hooks that we're about to fork Gitlab::Cluster::LifecycleEvents.do_before_fork end diff --git a/lib/gitlab/cluster/lifecycle_events.rb b/lib/gitlab/cluster/lifecycle_events.rb index e0f9eb59924..1bd3bb942c7 100644 --- a/lib/gitlab/cluster/lifecycle_events.rb +++ b/lib/gitlab/cluster/lifecycle_events.rb @@ -80,8 +80,6 @@ module Gitlab @puma_options = options end - private - def in_clustered_environment? # Sidekiq doesn't fork return false if Sidekiq.server? |