diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-05-09 15:07:50 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-05-09 15:07:50 +0000 |
commit | fb19b392e2331e7663c3d65c05aeb81a1db3630d (patch) | |
tree | edec8b9bfc56a39279df88578ccb6da5ca4783b4 /sidekiq_cluster | |
parent | e4b9c52cc9ca9478d9881d03f31517be46376060 (diff) | |
download | gitlab-ce-fb19b392e2331e7663c3d65c05aeb81a1db3630d.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'sidekiq_cluster')
-rw-r--r-- | sidekiq_cluster/cli.rb | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/sidekiq_cluster/cli.rb b/sidekiq_cluster/cli.rb index 408b3864d5e..52dc14130fb 100644 --- a/sidekiq_cluster/cli.rb +++ b/sidekiq_cluster/cli.rb @@ -20,7 +20,7 @@ require_relative 'sidekiq_cluster' module Gitlab module SidekiqCluster class CLI - THREAD_NAME = 'supervisor' + THREAD_NAME = 'sidekiq-cluster' # The signals that should terminate both the master and workers. TERMINATE_SIGNALS = %i(INT TERM).freeze @@ -134,23 +134,17 @@ module Gitlab ) metrics_server_pid = start_metrics_server - - all_pids = worker_pids + Array(metrics_server_pid) - - supervisor.supervise(all_pids) do |dead_pids| + supervisor.supervise(worker_pids + Array(metrics_server_pid)) do |dead_pids| # If we're not in the process of shutting down the cluster, # and the metrics server died, restart it. - if supervisor.alive && dead_pids.include?(metrics_server_pid) + if dead_pids == Array(metrics_server_pid) @logger.info('Sidekiq metrics server terminated, restarting...') metrics_server_pid = restart_metrics_server - all_pids = worker_pids + Array(metrics_server_pid) else # If a worker process died we'll just terminate the whole cluster. # We let an external system (runit, kubernetes) handle the restart. @logger.info('A worker terminated, shutting down the cluster') - - ProcessManagement.signal_processes(all_pids - dead_pids, :TERM) - # Signal supervisor not to respawn workers and shut down. + supervisor.shutdown [] end end |