summaryrefslogtreecommitdiff
path: root/config
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-04-08 18:09:16 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-04-08 18:09:16 +0000
commit80e9fdc9682cfbcfb9202a2733605a6a6bd23f05 (patch)
tree168375ea13d1a1f01d4cbcf6f0513fc9883e9477 /config
parent5372e109c0660e4670aa987568a51082beca1b3c (diff)
downloadgitlab-ce-80e9fdc9682cfbcfb9202a2733605a6a6bd23f05.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'config')
-rw-r--r--config/initializers/sidekiq_cluster.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/config/initializers/sidekiq_cluster.rb b/config/initializers/sidekiq_cluster.rb
index 4622984fe0c..4ff8dd9b936 100644
--- a/config/initializers/sidekiq_cluster.rb
+++ b/config/initializers/sidekiq_cluster.rb
@@ -13,6 +13,16 @@ if ENV['ENABLE_SIDEKIQ_CLUSTER']
# this case the parent PID changes and we need to terminate ourselves.
if Process.ppid != parent
Process.kill(:TERM, Process.pid)
+
+ # Wait for just a few extra seconds for a final attempt to
+ # gracefully terminate. Considering the parent (cluster) process
+ # have changed (SIGKILL'd), it shouldn't take long to shutdown.
+ sleep(5)
+
+ # Signaling the Sidekiq Pgroup as KILL is not forwarded to
+ # a possible child process. In Sidekiq Cluster, all child Sidekiq
+ # processes are PGROUP leaders (each process has its own pgroup).
+ Process.kill(:KILL, 0)
break
end
end